2 # Provides a list of pages no other page links to.
3 package IkiWiki::Plugin::orphans;
10 hook(type => "getsetup", id => "orphans", call => \&getsetup);
11 hook(type => "preprocess", id => "orphans", call => \&preprocess);
24 $params{pages}="*" unless defined $params{pages};
26 # Needs to update whenever a page is added or removed, so
27 # register a dependency.
28 add_depends($params{page}, $params{pages});
31 foreach my $page (pagespec_match_list(
32 [ grep { ! IkiWiki::backlink_pages($_) && $_ ne 'index' }
34 $params{pages}, location => $params{page})) {
35 # If the page has a link to some other page, it's
36 # indirectly linked to a page via that page's backlinks.
39 ($_ !~ /\/\Q$config{discussionpage}\E$/i || ! $config{discussion}) &&
40 bestlink($page, $_) !~ /^(\Q$page\E|)$/
45 return gettext("All pages have other pages linking to them.") unless @orphans;
50 htmllink($params{page}, $params{destpage}, $_,