- # 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}) {
- redirect($q, $pagestate{$page}{meta}{permalink});
+ my $link;
+ if (! IkiWiki::isinternal($page)) {
+ $link = bestlink("", $page);
+ }
+ elsif (defined $pagestate{$page}{meta}{permalink}) {
+ # Can only redirect to an internal page if it has a
+ # permalink.
+ IkiWiki::redirect($q, $pagestate{$page}{meta}{permalink});