Added some useless guff

This commit is contained in:
Matthew Connelly 2015-03-09 19:42:05 +00:00
parent 0fa7ac85d5
commit 2f75fbfee2
2 changed files with 8 additions and 1 deletions

View File

@ -17,6 +17,10 @@ use YAML;
use Dancer2;
my $ME = 'BlogAlba'; my $ME_GH = 'https://github.com/MaffC/BlogAlba/';
my $VERSION = '0.6';
my $HOST = `hostname`; chomp $HOST;
my $basedir=File::Spec->rel2abs(__FILE__);$basedir=~s/blogalba$//;
my $cfg="$basedir/config";
my $blog=YAML::LoadFile($cfg) or die "Couldn't load $cfg!";
@ -62,7 +66,7 @@ sub slugify {
}
sub timefmt {
my ($epoch,$context)=@_;
$epoch=str2time $epoch if $context eq 'readpost' or $context eq 'datetime';
$epoch=str2time $epoch if $epoch !~ /^[0-9]{10}$/;
my $dsuffix = 'th'; $dsuffix = 'st' if strftime("%d",localtime $epoch) eq '01'; $dsuffix = 'nd' if strftime("%d",localtime $epoch) eq '02';
return strftime "%A, %e$dsuffix %b. %Y", localtime $epoch if $context eq 'fancydate';
return strftime "%Y-%m-%dT%H:%M%z",localtime $epoch if $context eq 'datetime';
@ -137,6 +141,7 @@ sub do_cache {
push @nav, {navname => $_, navurl => $blog->{links}->{$_},} for keys $blog->{links};
%defparams = (
INDEX => 0, NAV => [@nav], url => $blog->{url}, recent => [@posts[0 .. ($#posts > 7? 7 : $#posts)]],
gentime => timefmt($lastcache, 'datetime'), version => $VERSION, generator => $ME, generatorurl => $ME_GH, host => $HOST,
about => $blog->{about}, author => $blog->{author}, name => $blog->{name}, tagline => $blog->{tagline}, keywords => $blog->{keywords},
robots => $blog->{config}->{indexable}? '<meta name="ROBOTS" content="INDEX, FOLLOW" />' : '<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />',
);

View File

@ -4,6 +4,8 @@
<TMPL_IF NAME="nextlink"><p style='float: right'><a href="/page/<TMPL_VAR NAME="nextpage">">Plunge further into posts of yore (page <TMPL_VAR NAME="nextpage">)</a></p></TMPL_IF>
</div></div>
</TMPL_IF>
Generated by <a href="<TMPL_VAR NAME="generatorurl">"><TMPL_VAR NAME="generator"></a> v<TMPL_VAR NAME="version"> on <TMPL_VAR NAME="host"> at <TMPL_VAR NAME="gentime"><br />
:3
</div>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>