From 05bb65fc687b357a5265f0c378a694b5b02d376d Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 22 Dec 2008 23:02:08 +0000 Subject: recentchanges_link CGI: If the linked page is internal, use its permalink This fixes a bug, that comments appear in recentchanges as broken links. --- IkiWiki/Plugin/recentchanges.pm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'IkiWiki/Plugin/recentchanges.pm') 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"; -- cgit v1.2.3