Better blog listing.

master
Blog Manager Robot 3 years ago
parent adaf1b6d4c
commit 158fe3bc66
  1. 13
      libs/MJB-Backend-Jekyll/lib/MJB/Backend/Jekyll.pm

@ -5,6 +5,7 @@ use Cwd qw( getcwd );
use File::Path qw( make_path );
use Storable qw( dclone );
use Mojo::File;
use MJB::Backend::Jekyll::MarkdownFile;
# The root path for the repositories
has root => (
@ -84,18 +85,16 @@ sub list_posts {
my $posts = Mojo::File->new( $self->repo_path . "/_posts" );
my $data;
my @files;
# TODO: Sort by date for the listing on the front end.
foreach my $file ( $posts->list->each ) {
my $title = $self->get_title_of_post($file->path);
my $path = $file->to_string;
$data->{titles}->{$title} = $path;
$data->{files}->{$path} = $title;
push @files, MJB::Backend::Jekyll::MarkdownFile->new(
path => $file->to_string,
);
}
return $data;
return [ @files ];
}
sub get_title_of_post {

Loading…
Cancel
Save