]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
recentchanges_link CGI: If the linked page is internal, use its permalink
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Mon, 22 Dec 2008 23:02:08 +0000 (23:02 +0000)
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Mon, 22 Dec 2008 23:02:08 +0000 (23:02 +0000)
This fixes a bug, that comments appear in recentchanges as broken links.

IkiWiki/Plugin/recentchanges.pm

index 12577e9efc9f56e1748a160a6cdab5b768540501..7071596e6603586d6d2682aef0c4d37f56b25788 100644 (file)
@@ -95,6 +95,15 @@ sub cgi ($) {
 
                IkiWiki::loadindex();
 
 
                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";
                my $link=bestlink("", $page);
                if (! length $link) {
                        print "Content-type: text/html\n\n";