summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2008-12-22 23:02:08 +0000
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2008-12-22 23:02:08 +0000
commit05bb65fc687b357a5265f0c378a694b5b02d376d (patch)
tree6366a1d56a5dd17104adc6181ba348e46b004b8a
parent7f1992cbe11732446b5199b8fdf4d6513a14688b (diff)
recentchanges_link CGI: If the linked page is internal, use its permalink
This fixes a bug, that comments appear in recentchanges as broken links.
-rw-r--r--IkiWiki/Plugin/recentchanges.pm9
1 files changed, 9 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm
index 12577e9ef..7071596e6 100644
--- a/IkiWiki/Plugin/recentchanges.pm
+++ b/IkiWiki/Plugin/recentchanges.pm
@@ -95,6 +95,15 @@ sub cgi ($) {
IkiWiki::loadindex();
+ # If the page is internal (like a comment), see if it has a
+ # permalink. Comments do.
+ if (IkiWiki::isinternal($page) &&
+ defined $pagestate{$page}{meta}{permalink}) {
+ IkiWiki::redirect($cgi,
+ $pagestate{$page}{meta}{permalink});
+ exit;
+ }
+
my $link=bestlink("", $page);
if (! length $link) {
print "Content-type: text/html\n\n";