my %params=@_;
$params{pages}="*" unless defined $params{pages};
- # Needs to update whenever a page is added or removed, so
- # register a dependency.
+ # Needs to update whenever a page is changed, added, or removed,
+ # in order to see the link changes.
add_depends($params{page}, $params{pages});
- my %linkedto;
- foreach my $p (keys %links) {
- map { $linkedto{bestlink($p, $_)}=1 if length $_ }
- @{$links{$p}};
- }
-
my @orphans;
- my $discussion=lc(gettext("Discussion"));
foreach my $page (pagespec_match_list(
- [ grep { ! $linkedto{$_} && $_ ne 'index' }
+ [ grep { ! IkiWiki::backlink_pages($_) && $_ ne 'index' }
keys %pagesources ],
$params{pages}, location => $params{page})) {
# If the page has a link to some other page, it's
# indirectly linked to a page via that page's backlinks.
next if grep {
length $_ &&
- ($_ !~ /\/\Q$discussion\E$/i || ! $config{discussion}) &&
+ ($_ !~ /\/\Q$config{discussionpage}\E$/i || ! $config{discussion}) &&
bestlink($page, $_) !~ /^(\Q$page\E|)$/
} @{$links{$page}};
push @orphans, $page;