From 6378fce759a6b202ea903edd9f34791b03303848 Mon Sep 17 00:00:00 2001 From: Bill Stumbo Date: Thu, 17 Sep 2026 22:03:55 -0400 Subject: [PATCH 1/3] Restore Bibliography entry in History sidebar Top-level toc_hide:false keeps the section itself visible (Hugo merges a section's own cascade into its own Params, so cascade alone hid it), while cascade toc_hide:true keeps generated entries out of the nav. Removes the empty section-index.html override that suppressed subpage cards site-wide. Adds sidebar regression tests. --- content/en/history/bibliography/_index.md | 5 ++- layouts/_partials/section-index.html | 1 - tests/test_hugo_build.py | 50 +++++++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) delete mode 100644 layouts/_partials/section-index.html diff --git a/content/en/history/bibliography/_index.md b/content/en/history/bibliography/_index.md index 3f5110ed..d1c6a953 100644 --- a/content/en/history/bibliography/_index.md +++ b/content/en/history/bibliography/_index.md @@ -3,9 +3,12 @@ title: Bibliography heading: Interlisp Bibliography type: bibliography robots: "noindex, follow" +# Keep this section visible in the sidebar. Hugo merges a section's own +# cascade into its own Params, so cascade.toc_hide alone would hide it. +toc_hide: false cascade: type: bibliography - toc_hide: false + toc_hide: true weight: 5 aliases: - /bibliography/ diff --git a/layouts/_partials/section-index.html b/layouts/_partials/section-index.html deleted file mode 100644 index 20780b79..00000000 --- a/layouts/_partials/section-index.html +++ /dev/null @@ -1 +0,0 @@ -{{/* section-index disabled: subpage navigation via td-section-nav only */}} diff --git a/tests/test_hugo_build.py b/tests/test_hugo_build.py index 24596afc..5b630f04 100644 --- a/tests/test_hugo_build.py +++ b/tests/test_hugo_build.py @@ -160,6 +160,56 @@ def test_bibliography_section_present(self): ) +class TestHistorySidebarNavigation: + """The Bibliography section must be reachable from History navigation. + + Regression tests for PR #347: setting only ``cascade.toc_hide`` hid the + Bibliography entry itself from the History sidebar (Hugo merges a + section's own cascade into its own Params), and the empty + ``layouts/_partials/section-index.html`` override removed the subpage + cards. Either failure must break the build tests. + """ + + @pytest.fixture(autouse=True) + def history_page(self, production_build): + self.build_result = production_build + path = PROD_PUBLIC / "history" / "index.html" + if not path.exists(): + pytest.skip("history/index.html not found — run a production build first") + self.content = path.read_text(encoding="utf-8", errors="ignore") + + def test_bibliography_in_sidebar_nav(self) -> None: + """The sidebar nav on /history/ must link to /history/bibliography/.""" + nav = re.search( + r']*id="td-section-nav".*?', + self.content, + re.DOTALL, + ) + assert nav, "sidebar nav #td-section-nav not found on history page" + assert "/history/bibliography/" in nav.group(0), ( + "Bibliography entry missing from the History sidebar navigation" + ) + + def test_bibliography_subpage_card_present(self) -> None: + """The History page must render subpage cards including Bibliography.""" + marker = '
' + assert marker in self.content, ( + "section-index subpage list missing from the History page body" + ) + tail = self.content.split(marker, 1)[1] + assert "/history/bibliography/" in tail, ( + "Bibliography subpage card missing from the History page body" + ) + + def test_no_sidebar_truncation_warning(self) -> None: + """Hugo must not truncate sidebar entries — a flood of unhidden + bibliography entries (e.g. from a stale Zotero cache without + ``toc_hide``) would trigger this Docsy warning.""" + assert "sidebar entries have been truncated" not in ( + self.build_result.stderr or "" + ), "Sidebar entries were truncated — bibliography entries may be leaking into navigation" + + class TestInternalLinks: """All internal href links in the built HTML must resolve to existing pages.""" From c503ea0330e6e726fee93cef6ab57c6a78e038e4 Mon Sep 17 00:00:00 2001 From: Bill Stumbo Date: Thu, 17 Sep 2026 22:09:44 -0400 Subject: [PATCH 2/3] Show Intake Guide in sidebar while keeping entries hidden Explicit top-level toc_hide:false on the intake guide overrides the bibliography section's cascade (which Hugo merges into children's Params). Generated entries stay out via their own toc_hide. Extends the sidebar regression tests to cover both. --- .../en/history/bibliography/intake/_index.md | 4 ++++ tests/test_hugo_build.py | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/content/en/history/bibliography/intake/_index.md b/content/en/history/bibliography/intake/_index.md index 97991332..0c0843ec 100644 --- a/content/en/history/bibliography/intake/_index.md +++ b/content/en/history/bibliography/intake/_index.md @@ -2,6 +2,10 @@ title: Interlisp Bibliography Intake Guide weight: 1 type: docs +# Explicitly visible in the sidebar: the parent bibliography section's +# cascade sets toc_hide:true (to keep generated entries out of the nav), +# and Hugo merges cascade into children's Params too. +toc_hide: false --- ## I have something I think belongs in the Interlisp Bibliography! diff --git a/tests/test_hugo_build.py b/tests/test_hugo_build.py index 5b630f04..fcb7ee05 100644 --- a/tests/test_hugo_build.py +++ b/tests/test_hugo_build.py @@ -190,6 +190,27 @@ def test_bibliography_in_sidebar_nav(self) -> None: "Bibliography entry missing from the History sidebar navigation" ) + def test_intake_guide_in_sidebar_nav(self) -> None: + """The Intake Guide must be listed under Bibliography, while the + hundreds of generated entries must stay out of the nav.""" + nav = re.search( + r']*id="td-section-nav".*?', + self.content, + re.DOTALL, + ) + assert nav, "sidebar nav #td-section-nav not found on history page" + nav_html = nav.group(0) + assert "/history/bibliography/intake/" in nav_html, ( + "Intake Guide entry missing from the sidebar navigation" + ) + stray_entries = re.findall( + r'href="/history/bibliography/(?!intake/)[a-z0-9]+/"', nav_html + ) + assert not stray_entries, ( + "Generated bibliography entries leaking into sidebar navigation:\n" + + "\n".join(stray_entries[:10]) + ) + def test_bibliography_subpage_card_present(self) -> None: """The History page must render subpage cards including Bibliography.""" marker = '
' From 14ede88092ff74625219d2ef4fc40936ec64afab Mon Sep 17 00:00:00 2001 From: Bill Stumbo Date: Thu, 17 Sep 2026 22:16:30 -0400 Subject: [PATCH 3/3] Restore empty section-index override; subpage nav stays in sidebar Subpage cards at the bottom of section pages are intentionally suppressed - navigation lives in the left pane. The sidebar regression tests now assert the cards stay absent. --- layouts/_partials/section-index.html | 1 + tests/test_hugo_build.py | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 12 deletions(-) create mode 100644 layouts/_partials/section-index.html diff --git a/layouts/_partials/section-index.html b/layouts/_partials/section-index.html new file mode 100644 index 00000000..20780b79 --- /dev/null +++ b/layouts/_partials/section-index.html @@ -0,0 +1 @@ +{{/* section-index disabled: subpage navigation via td-section-nav only */}} diff --git a/tests/test_hugo_build.py b/tests/test_hugo_build.py index fcb7ee05..55c22fee 100644 --- a/tests/test_hugo_build.py +++ b/tests/test_hugo_build.py @@ -165,9 +165,10 @@ class TestHistorySidebarNavigation: Regression tests for PR #347: setting only ``cascade.toc_hide`` hid the Bibliography entry itself from the History sidebar (Hugo merges a - section's own cascade into its own Params), and the empty - ``layouts/_partials/section-index.html`` override removed the subpage - cards. Either failure must break the build tests. + section's own cascade into its own Params). The empty + ``layouts/_partials/section-index.html`` override is intentional and + must keep suppressing the subpage cards. Either deviation must break + the build tests. """ @pytest.fixture(autouse=True) @@ -211,15 +212,12 @@ def test_intake_guide_in_sidebar_nav(self) -> None: + "\n".join(stray_entries[:10]) ) - def test_bibliography_subpage_card_present(self) -> None: - """The History page must render subpage cards including Bibliography.""" - marker = '
' - assert marker in self.content, ( - "section-index subpage list missing from the History page body" - ) - tail = self.content.split(marker, 1)[1] - assert "/history/bibliography/" in tail, ( - "Bibliography subpage card missing from the History page body" + def test_no_subpage_cards(self) -> None: + """The History page must not render section-index subpage cards; + subpage navigation lives in the sidebar. The empty + ``layouts/_partials/section-index.html`` override suppresses them.""" + assert '
' not in self.content, ( + "section-index subpage list should be suppressed on the History page" ) def test_no_sidebar_truncation_warning(self) -> None: