stuff
This commit is contained in:
48
new_post.pl
Normal file
48
new_post.pl
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Carp qw(croak);
|
||||
use HTML::Composer;
|
||||
use File::Slurp;
|
||||
|
||||
my $post_name = $ARGV[0];
|
||||
if ( !$post_name ) {
|
||||
croak "No post named provided!";
|
||||
}
|
||||
|
||||
my $h = HTML::Composer->new;
|
||||
|
||||
my $post_template = [
|
||||
head => [
|
||||
title => ["An awesome new post!"],
|
||||
meta => { name => "description", content => "Description of post" },
|
||||
meta => { name => "robots" },
|
||||
meta => { name => "keywords", content => "Awesome keywords" },
|
||||
meta => { name => "charset", content => "utf-8", charset => "utf-8" },
|
||||
link => { href => "/index.css", rel => "stylesheet" }
|
||||
],
|
||||
body => [
|
||||
a => { href => "/" } => ["<< back"],
|
||||
h1 => ["Post Title"],
|
||||
p => ["Blah blah blah"],
|
||||
h2 => ["Sub title"],
|
||||
p => ["Blah blah blah"],
|
||||
h4 => ["Related links:"],
|
||||
ul => [
|
||||
li => [
|
||||
a => { href => "https://rawley.xyz/related-content" } =>
|
||||
["Related content"]
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
my $html = $h->html($post_template);
|
||||
|
||||
print "Writing $post_name.html\n";
|
||||
|
||||
write_file( "posts/$post_name.html", $html );
|
||||
|
||||
print "DONE\n";
|
||||
Reference in New Issue
Block a user