Skip to content

Commit fff6711

Browse files
authored
Bs32 broken bib index (#348)
* 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. * 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. * 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.
1 parent 604f164 commit fff6711

3 files changed

Lines changed: 77 additions & 1 deletion

File tree

‎content/en/history/bibliography/_index.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ title: Bibliography
33
heading: Interlisp Bibliography
44
type: bibliography
55
robots: "noindex, follow"
6+
# Keep this section visible in the sidebar. Hugo merges a section's own
7+
# cascade into its own Params, so cascade.toc_hide alone would hide it.
8+
toc_hide: false
69
cascade:
710
type: bibliography
8-
toc_hide: false
11+
toc_hide: true
912
weight: 5
1013
aliases:
1114
- /bibliography/

‎content/en/history/bibliography/intake/_index.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
title: Interlisp Bibliography Intake Guide
33
weight: 1
44
type: docs
5+
# Explicitly visible in the sidebar: the parent bibliography section's
6+
# cascade sets toc_hide:true (to keep generated entries out of the nav),
7+
# and Hugo merges cascade into children's Params too.
8+
toc_hide: false
59
---
610

711
## I have something I think belongs in the Interlisp Bibliography!

‎tests/test_hugo_build.py‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,75 @@ def test_bibliography_section_present(self):
160160
)
161161

162162

163+
class TestHistorySidebarNavigation:
164+
"""The Bibliography section must be reachable from History navigation.
165+
166+
Regression tests for PR #347: setting only ``cascade.toc_hide`` hid the
167+
Bibliography entry itself from the History sidebar (Hugo merges a
168+
section's own cascade into its own Params). The empty
169+
``layouts/_partials/section-index.html`` override is intentional and
170+
must keep suppressing the subpage cards. Either deviation must break
171+
the build tests.
172+
"""
173+
174+
@pytest.fixture(autouse=True)
175+
def history_page(self, production_build):
176+
self.build_result = production_build
177+
path = PROD_PUBLIC / "history" / "index.html"
178+
if not path.exists():
179+
pytest.skip("history/index.html not found — run a production build first")
180+
self.content = path.read_text(encoding="utf-8", errors="ignore")
181+
182+
def test_bibliography_in_sidebar_nav(self) -> None:
183+
"""The sidebar nav on /history/ must link to /history/bibliography/."""
184+
nav = re.search(
185+
r'<nav[^>]*id="td-section-nav".*?</nav>',
186+
self.content,
187+
re.DOTALL,
188+
)
189+
assert nav, "sidebar nav #td-section-nav not found on history page"
190+
assert "/history/bibliography/" in nav.group(0), (
191+
"Bibliography entry missing from the History sidebar navigation"
192+
)
193+
194+
def test_intake_guide_in_sidebar_nav(self) -> None:
195+
"""The Intake Guide must be listed under Bibliography, while the
196+
hundreds of generated entries must stay out of the nav."""
197+
nav = re.search(
198+
r'<nav[^>]*id="td-section-nav".*?</nav>',
199+
self.content,
200+
re.DOTALL,
201+
)
202+
assert nav, "sidebar nav #td-section-nav not found on history page"
203+
nav_html = nav.group(0)
204+
assert "/history/bibliography/intake/" in nav_html, (
205+
"Intake Guide entry missing from the sidebar navigation"
206+
)
207+
stray_entries = re.findall(
208+
r'href="/history/bibliography/(?!intake/)[a-z0-9]+/"', nav_html
209+
)
210+
assert not stray_entries, (
211+
"Generated bibliography entries leaking into sidebar navigation:\n"
212+
+ "\n".join(stray_entries[:10])
213+
)
214+
215+
def test_no_subpage_cards(self) -> None:
216+
"""The History page must not render section-index subpage cards;
217+
subpage navigation lives in the sidebar. The empty
218+
``layouts/_partials/section-index.html`` override suppresses them."""
219+
assert '<div class="section-index">' not in self.content, (
220+
"section-index subpage list should be suppressed on the History page"
221+
)
222+
223+
def test_no_sidebar_truncation_warning(self) -> None:
224+
"""Hugo must not truncate sidebar entries — a flood of unhidden
225+
bibliography entries (e.g. from a stale Zotero cache without
226+
``toc_hide``) would trigger this Docsy warning."""
227+
assert "sidebar entries have been truncated" not in (
228+
self.build_result.stderr or ""
229+
), "Sidebar entries were truncated — bibliography entries may be leaking into navigation"
230+
231+
163232
class TestInternalLinks:
164233
"""All internal href links in the built HTML must resolve to existing pages."""
165234

0 commit comments

Comments
 (0)