-$blob = readfile("t/tmp/out/sorting/old.html");
-ok($blob =~ m{^trail=sorting n=sorting/new p=$}m);
-$blob = readfile("t/tmp/out/sorting/new.html");
-ok($blob =~ m{^trail=sorting n=sorting/middle p=sorting/old$}m);
-$blob = readfile("t/tmp/out/sorting/middle.html");
-ok($blob =~ m{^trail=sorting n=sorting/linked2 p=sorting/new$}m);
-$blob = readfile("t/tmp/out/sorting/linked2.html");
-ok($blob =~ m{^trail=sorting n=sorting/linked p=sorting/middle$}m);
-$blob = readfile("t/tmp/out/sorting/linked.html");
-ok($blob =~ m{^trail=sorting n=sorting/end p=sorting/linked2$}m);
-$blob = readfile("t/tmp/out/sorting/end.html");
-ok($blob =~ m{^trail=sorting n=sorting/a/c p=sorting/linked$}m);
-$blob = readfile("t/tmp/out/sorting/a/c.html");
-ok($blob =~ m{^trail=sorting n=sorting/beginning p=sorting/end$}m);
-$blob = readfile("t/tmp/out/sorting/beginning.html");
-ok($blob =~ m{^trail=sorting n=sorting/a/b p=sorting/a/c$}m);
-$blob = readfile("t/tmp/out/sorting/a/b.html");
-ok($blob =~ m{^trail=sorting n=sorting/ancient p=sorting/beginning$}m);
-$blob = readfile("t/tmp/out/sorting/ancient.html");
-ok($blob =~ m{^trail=sorting n=sorting/z/a p=sorting/a/b$}m);
-$blob = readfile("t/tmp/out/sorting/z/a.html");
-ok($blob =~ m{^trail=sorting n= p=sorting/ancient$}m);
+check_trail("sorting/old.html", "n=sorting/new p=");
+check_trail("sorting/new.html", "n=sorting/middle p=sorting/old");
+check_trail("sorting/middle.html", "n=sorting/linked2 p=sorting/new");
+check_trail("sorting/linked2.html", "n=sorting/linked p=sorting/middle");
+check_trail("sorting/linked.html", "n=sorting/end p=sorting/linked2");
+check_trail("sorting/end.html", "n=sorting/a/c p=sorting/linked");
+check_trail("sorting/a/c.html", "n=sorting/beginning p=sorting/end");
+check_trail("sorting/beginning.html", "n=sorting/a/b p=sorting/a/c");
+check_trail("sorting/a/b.html", "n=sorting/ancient p=sorting/beginning");
+check_trail("sorting/ancient.html", "n=sorting/z/a p=sorting/a/b");
+check_trail("sorting/z/a.html", "n= p=sorting/ancient");
+
+# If the inline has a limited number of pages, the trail still depends on
+# everything, so it gets rebuilt even though it doesn't strictly need it.
+# This means we could use it as a way to recompute the order of members
+# and the contents of their trail navbars, allowing us to fix the regression
+# described in [[bugs/trail excess dependencies]] without a full content
+# dependency.
+$blob = readfile("t/tmp/out/limited.html");
+ok($blob =~ /<a href="(\.\/)?limited\/a.html">a<\/a>/m);
+ok($blob =~ /<a href="(\.\/)?limited\/b.html">b<\/a>/m);
+ok($blob !~ /<a href="(\.\/)?limited\/c.html">/m);
+ok($blob !~ /<a href="(\.\/)?limited\/d.html">/m);
+check_trail("limited/a.html", "n=limited/b p=");
+check_trail("limited/b.html", "n=limited/c p=limited/a");
+check_trail("limited/c.html", "n=limited/d p=limited/b");
+check_trail("limited/d.html", "n= p=limited/c");
+# Also, b and d should pick up the change to c. This regressed with the
+# change to using a presence dependency.
+$blob = readfile("t/tmp/out/limited/b.html");
+ok($blob =~ /New C page >/m);
+$blob = readfile("t/tmp/out/limited/d.html");
+ok($blob =~ /< New C page/m);
+
+# Members of a retitled trail should pick up that change.
+# This regressed with the change to using a presence dependency.
+$blob = readfile("t/tmp/out/retitled/a.html");
+ok($blob =~ /\^ the new title \^/m);
+
+# untrail is no longer a trail, so these are no longer in it.
+check_no_trail("untrail/a.html");
+check_no_trail("untrail/b.html");