+
+ # Common prefix should not be a page in the map.
+ while (defined $common_prefix && length $common_prefix &&
+ exists $mapitems{$common_prefix}) {
+ $common_prefix=IkiWiki::dirname($common_prefix);
+ }
+
+ # Needs to update whenever a page is added or removed, so
+ # register a dependency.
+ add_depends($params{page}, $params{pages});
+ # Explicitly add all currently shown pages, to detect when pages
+ # are removed.
+ add_depends($params{page}, join(" or ", keys %mapitems));