Rendering template

This commit is contained in:
Nathan McCarty 2025-02-03 21:36:07 -05:00
parent abe676f512
commit 815ff4bf4e
3 changed files with 71 additions and 0 deletions

15
blog
View file

@ -22,6 +22,9 @@ my IO::Path:D $default-db-dir =
$default-blog-dir.add('db/')
};
#| The default output directory
my IO::Path:D $default-site-dir = $default-blog-dir.add('site/');
#| Initalize the database
multi MAIN(
"db",
@ -108,3 +111,15 @@ multi MAIN(
say 'Post inserted with id ', $id;
say 'Post has slugs: ', $db.posts{$id}.all-slugs;
}
#| Render the blog to html
multi MAIN(
"render",
#| The path of the database directory
IO::Path(Str) :$db-dir = $default-db-dir,
#| The path of the output directory
IO::Path(Str) :$site-dir = $default-site-dir,
) {
my $db = read-db $db-dir;
$db.render: $site-dir;
}