diff --git a/libs/MJB-Backend-Jekyll/lib/MJB/Backend/Jekyll.pm b/libs/MJB-Backend-Jekyll/lib/MJB/Backend/Jekyll.pm index a4c2489..1936172 100644 --- a/libs/MJB-Backend-Jekyll/lib/MJB/Backend/Jekyll.pm +++ b/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 {