Added the ability to disable publishing an RSS feed, renamed the rss_posts directive to a clearer name, recent_posts
This commit is contained in:
parent
8dbb07a23f
commit
9cfcf90d6a
6
blogalba
6
blogalba
|
@ -147,7 +147,7 @@ sub generate_feed {
|
||||||
link => $_->{permaurl},
|
link => $_->{permaurl},
|
||||||
description => ($blog->{config}->{rss_excerpt}? $_->{excerpt} : $_->{body}),
|
description => ($blog->{config}->{rss_excerpt}? $_->{excerpt} : $_->{body}),
|
||||||
dc => { creator => $blog->{author}, },
|
dc => { creator => $blog->{author}, },
|
||||||
) for @posts[0 .. ($#posts > ($blog->{config}->{rss_posts}-1)? ($blog->{config}->{rss_posts}-1) : $#posts)];
|
) for @posts[0 .. ($#posts > ($blog->{config}->{recent_posts}-1)? ($blog->{config}->{recent_posts}-1) : $#posts)];
|
||||||
$feed->save("$basedir/public/feed-rss2.xml");
|
$feed->save("$basedir/public/feed-rss2.xml");
|
||||||
}
|
}
|
||||||
sub do_cache {
|
sub do_cache {
|
||||||
|
@ -175,8 +175,8 @@ sub do_cache {
|
||||||
push @nav, {navname => $_, navurl => $blog->{links}->{$_},} for sort { $b cmp $a } keys $blog->{links};
|
push @nav, {navname => $_, navurl => $blog->{links}->{$_},} for sort { $b cmp $a } keys $blog->{links};
|
||||||
generate_feed;
|
generate_feed;
|
||||||
%defparams = (
|
%defparams = (
|
||||||
INDEX => 0, NAV => [@nav], url => $blog->{url}, recent => [@posts[0 .. ($#posts > ($blog->{config}->{rss_posts}-1)? ($blog->{config}->{rss_posts}-1) : $#posts)]],
|
INDEX => 0, NAV => [@nav], url => $blog->{url}, recent => [@posts[0 .. ($#posts > ($blog->{config}->{recent_posts}-1)? ($blog->{config}->{recent_posts}-1) : $#posts)]],
|
||||||
gentime => timefmt($lastcache, '%H:%M %e/%-m/%y %Z'), genworktime => sprintf("%.2f ms", tv_interval($st)*100), host => $HOST,
|
gentime => timefmt($lastcache, '%H:%M %e/%-m/%y %Z'), genworktime => sprintf("%.2f ms", tv_interval($st)*100), host => $HOST, rss_enabled => $blog->{rss_publish},
|
||||||
about => $blog->{about}, author => $blog->{author}, name => $blog->{name}, tagline => $blog->{tagline}, keywords => $blog->{keywords},
|
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" />',
|
robots => $blog->{config}->{indexable}? '<meta name="ROBOTS" content="INDEX, FOLLOW" />' : '<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />',
|
||||||
);
|
);
|
||||||
|
|
3
config
3
config
|
@ -9,8 +9,9 @@ posturlprepend: wrote/
|
||||||
config:
|
config:
|
||||||
indexable: 1
|
indexable: 1
|
||||||
per_page: 6
|
per_page: 6
|
||||||
|
recent_posts: 8
|
||||||
|
rss_publish: 1
|
||||||
rss_excerpt: 1
|
rss_excerpt: 1
|
||||||
rss_posts: 8
|
|
||||||
date_format: "%H:%M on %A, %d/%m/%y"
|
date_format: "%H:%M on %A, %d/%m/%y"
|
||||||
links:
|
links:
|
||||||
Twitter: https://twitter.com/maffsie
|
Twitter: https://twitter.com/maffsie
|
||||||
|
|
|
@ -13,7 +13,9 @@
|
||||||
<TMPL_VAR NAME="robots">
|
<TMPL_VAR NAME="robots">
|
||||||
<meta name="google-site-verification" content="QtCkt_CI6tmKhrNsw0KvEpScFjDRQQPvmwHGdSTYnGE" />
|
<meta name="google-site-verification" content="QtCkt_CI6tmKhrNsw0KvEpScFjDRQQPvmwHGdSTYnGE" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||||
|
<TMPL_IF NAME="rss_enabled">
|
||||||
<link rel="alternate" type="application/rss+xml" title="<TMPL_VAR NAME="title"> (RSS 2.0)" href="<TMPL_VAR NAME="url">/feed-rss2.xml" />
|
<link rel="alternate" type="application/rss+xml" title="<TMPL_VAR NAME="title"> (RSS 2.0)" href="<TMPL_VAR NAME="url">/feed-rss2.xml" />
|
||||||
|
</TMPL_IF>
|
||||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.2/custom/bootstrap.min.css" />
|
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.2/custom/bootstrap.min.css" />
|
||||||
<link rel="stylesheet" href="/main.css" />
|
<link rel="stylesheet" href="/main.css" />
|
||||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/solarized_dark.min.css" />
|
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/solarized_dark.min.css" />
|
||||||
|
|
Loading…
Reference in New Issue