Link a breadcrumb's group to the group's own page
Mirror to forge / mirror (push) Canceled after 0s
Validate / validate (push) Canceled after 0s
Validate / history (push) Canceled after 0s
Validate / site (push) Canceled after 0s
Validate / deploy (push) Canceled after 0s

The group crumb on a trail page went to an anchor on the places index;
it now goes to /regions/<group>/, as the state and province pages do.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-18 17:44:44 -07:00
1 parent fd7e0302ca
commit 9e435fa2a4
4 files changed
+38 -3

No files matched your search

+1 -1
View File
@@ -169,7 +169,7 @@ class PlaceTest(unittest.TestCase):
body = trail.render(fake(1, regions=["CO"]), GH)[2]
crumbs = body[body.index('<nav class="breadcrumb"'):body.index("</nav>")]
self.assertIn('<a href="/regions/">Places</a>', crumbs)
self.assertIn('<a href="/regions/#mountain-west">Mountain West</a>', crumbs)
self.assertIn('<a href="/regions/mountain-west/">Mountain West</a>', crumbs)
self.assertIn('<a href="/regions/us-co/">Colorado</a>', crumbs)
+31
View File
@@ -233,6 +233,37 @@ class JsonLdTest(unittest.TestCase):
self.assertEqual("geo" in place, bool(built.get("bbox") or h.get("start_lonlat") or h.get("end_lonlat")),
rec["id"])
def test_group_crumbs_go_to_the_group_page(self):
from olt import facets
names = {facets.GROUP_NAME[g]: g for g in facets.GROUP_NAME}
seen_trail = seen_state = 0
for path, doc in self.pages.items():
if not (path.startswith(("trails/", "regions/")) and path.endswith("index.html")):
continue
crumbs = visible_crumbs(doc)
for text, href in crumbs[:-1]:
g = names.get(text)
if g is None or not href:
continue
self.assertEqual(href, regions.group_path(g), path)
self.assertIn(regions.group_path(g).strip("/") + "/index.html", self.pages, path)
seen_trail += path.startswith("trails/")
seen_state += path.startswith("regions/")
# ...and the BreadcrumbList item for it is the same address
lists = [n for n in nodes_of(doc) if n["@type"] == "BreadcrumbList"]
for i, (text, href) in zip(lists[0]["itemListElement"] if lists else [], crumbs):
if names.get(i["name"]) and href:
self.assertEqual(i["item"], BASE + regions.group_path(names[i["name"]]), path)
self.assertGreater(seen_trail, 0)
self.assertGreater(seen_state, 0)
def test_no_page_links_to_a_group_anchor_that_has_a_page(self):
from olt import facets
for path, doc in self.pages.items():
for g in facets.GROUP_NAME:
if regions.group_path(g).strip("/") + "/index.html" in self.pages:
self.assertNotIn(f'href="/regions/#{g}"', doc, path)
def test_breadcrumbs_equal_the_visible_ones(self):
counted = 0
for path, doc in self.pages.items():