tweak recentchanges permalink code

Need to handle the case where url is not set.
master
Joey Hess 2008-10-17 21:54:42 -04:00
parent fdb5da46b0
commit 35c56622ea
4 changed files with 10 additions and 3 deletions

View File

@ -115,8 +115,6 @@ sub store ($$$) { #{{{
my $change=shift;
my $page="$config{recentchangespage}/change_".titlepage($change->{rev});
my $baseurl = IkiWiki::baseurl();
my $permalink="$baseurl$config{recentchangespage}/#change-".titlepage($change->{rev});
# Optimisation to avoid re-writing pages. Assumes commits never
# change (or that any changes are not important).
@ -177,8 +175,11 @@ sub store ($$$) { #{{{
commitdate => displaytime($change->{when}, "%X %x"),
commitdate_raw => scalar localtime($change->{when}),
wikiname => $config{wikiname},
permalink => $permalink,
);
$template->param(permalink => $config{url}."$config{recentchangespage}/#change-".titlepage($change->{rev}))
if exists $config{url};
IkiWiki::run_hooks(pagetemplate => sub {
shift->(page => $page, destpage => $page,
template => $template, rev => $change->{rev});

2
debian/changelog vendored
View File

@ -6,6 +6,8 @@ ikiwiki (2.68) UNRELEASED; urgency=low
move it to toggle.js in the javascript underlay.
* relativedate: New javascript-alicious plugin that makes all dates display
relative, in a very nice way, if I say so myself.
* recentchanges: Make feed links point back to anchors on the recentchanges
page. (JasonBlevins)
-- Joey Hess <joeyh@debian.org> Fri, 17 Oct 2008 20:11:02 -0400

View File

@ -96,3 +96,5 @@ to turn on? --Chapman Flack
>>>>>> Here's my attempt at a [[patch]] for anchor-based change permalinks:
>>>>>> <http://pastie.org/295016>.
>>>>>> --[[JasonBlevins]], 2008-10-17
[[done]]

View File

@ -3,7 +3,9 @@
[[!meta authorurl="""<TMPL_VAR AUTHORURL>"""]]
</TMPL_IF>
[[!meta title="""change to<TMPL_LOOP NAME="PAGES"> <TMPL_VAR PAGE></TMPL_LOOP> on <TMPL_VAR WIKINAME>"""]]
<TMPL_IF PERMALINK>
[[!meta permalink="<TMPL_VAR PERMALINK>"]]
</TMPL_IF>
<div id="change-<TMPL_VAR REV>" class="metadata">
<div class="metadata">
<span class="desc"><br />Changed pages:</span>