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