fix: make per-type page switches consistent - #2106
Merged
Merged
Conversation
The original steps built a second scratch site with symlinks. Symlinks do not work on Hugo's layouts mount, and the harness is now committed, so GetPageFlag's assertions belong beside TitleCase's. Also records why this branch is cut from PR 1 rather than main, and that it must be rebased before opening: workflows filter on base main/beta, so a stacked PR gets no CI and retargeting does not revive it.
Both were read only from the global site parameter, while the neighbouring metadata and includeToc parameters already cascaded per type. They now resolve through page frontmatter, then per-type, then global, so reading time can be kept for one content type and dropped for another. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Row 2 of the GetPageFlag assertions passed default=true against a want of true, coinciding with the fixture's configured global wordCount value. A resolver with the global-tier lookup deleted entirely still returned true for that call, so the assertion proved nothing about that tier. Switching its default to false forces a pass to depend on the resolver actually reading site.Params.pages.wordCount. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GetIncludeTOC.html tests isset with a mixed-case key; Hugo lowercases front matter and isset is case-sensitive, so per-page includeToc has never worked. The two TOC paths are broken in opposite directions and the original task would have regressed the half that still worked, with every verification step passing.
GetMetadata.html accepted "original" as a valid value and the docs described it as suppressing the modification date, but nothing read it. It rendered identically to "full". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…opdown GetIncludeTOC.html tested `isset .Params "includeToc"` in mixed case. Hugo lowercases front-matter keys and isset is case-sensitive, so the per-page branch was never taken and front-matter includeToc was silently ignored by the sidebar table of contents. The mobile dropdown had the mirror-image defect: it read the page parameter directly and never consulted the per-type value. Setting pages.<Type>.includeToc = false hid the sidebar TOC while leaving the dropdown visible. Both paths now resolve through GetIncludeToc.html, which honors the global toggle, the per-page parameter, and the per-type value. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…g errors correctly The per-page includeToc tier went live for the first time in this branch (Hugo lowercases front-matter keys, and the isset check was fixed to match), but it had no type check, unlike the per-type tier right below it. YAML 1.2 parses `no`/`yes` as strings, so `includeToc: no` propagated a truthy string past every consumer's truthiness check and rendered a TOC that should have been suppressed. Mirror the existing per-type check into the per-page branch, following the page-scoped wording precedent in GetSidebarIcons.html. GetPageFlag.html blamed every bad-type error on the page, even when the bad value came from the global or per-type site config. Track which tier supplied the value alongside each assignment and name that tier in the error, using the caller's original key spelling instead of the lowercased lookup form. Also fix the test fixture that set includeToc's per-type override with an all-lowercase key: this branch is about key-casing bugs, so the fixture should use the camelCase spelling a real author writes, proving normalisation instead of avoiding it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for gethinode-demo ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
markdumay
enabled auto-merge
August 1, 2026 17:56
Collaborator
Author
|
🎉 This PR is included in version 3.15.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three defects that share one shape: a switch is honored in one place and ignored in another.
1.
readingTimeandwordCounthad no per-type cascadesite.Params.pageshas three consumers. Two cascaded per content type; the third did not.utilities/GetMetadata.htmlmetadatautilities/GetIncludeTOC.htmlincludeTocpage/metadata.htmlreadingTime,wordCountSo "reading time on blog, off elsewhere" was inexpressible. The neighbouring
metadataparam cascades but is all-or-nothing —
nonedrops the date and word count too.A new
utilities/GetPageFlag.htmlresolves a bool through page front matter, then per-type,then global, then the caller's default. Both params gain per-page overrides as well.
* see 3 — that "yes" was not true either.
2.
metadata = "original"was accepted and documented but inertGetMetadata.htmlvalidatedoriginalas a supported value and the documentation stated itomits the modification date. Nothing read it, so
fullandoriginalrendered identically.Now implemented as documented.
3. The
includeToccascade was broken in both directionsGetIncludeTOC.htmltestedisset .Params "includeToc"in mixed case. Hugo lowercasesfront-matter keys to
includetoc, andissetis case-sensitive — unlikeindexandfield access, which go through
maps.Params.Get. So the per-page branch was never taken.Meanwhile the mobile TOC dropdown re-derived the value inline in
header.htmlanddocs/header.html, consulting the page parameter but never the per-type value.Neither path honored both. Both now resolve through
GetIncludeToc.html.Fixing the dead branch exposed a second bug behind it: the per-page tier had no bool type
check, harmless while it was unreachable. Hugo parses YAML as 1.2, so
includeToc: nois astring, and every consumer tests truthiness. It is now type-checked like its per-type
sibling.
Upgrade notes
includeTocnow works. Pages settingincludeToc: falsethat stillshowed a sidebar TOC will lose it; pages setting
includeToc: trueunder a per-typeincludeToc = falsewill gain one. Rendering changes in both directions — thelargest visible delta in this release.
before, so it can only disappear, never newly appear.
navigation.tocmust be present. A site that deleted the key rather than setting itto
falsepreviously still got the dropdown; it no longer does. Set it explicitly.readingTimeandwordCountcascade per page and per type, matchingmetadataandincludeToc. Sites setting them globally are unaffected; a strayreadingTimein frontmatter will take effect for the first time.
readingTime,wordCountandincludeTocmustbe booleans wherever they are set. Note YAML 1.2 parses
yes/noas strings — usetrue/false.metadata = "original"behaves as documented, showing the publication date insteadof the modification date. Pages using it rendered identically to
fullbefore.Tests
Extends the template harness added in #2104: 35 assertions, including one per cascade tier
for both resolvers. Each was verified to discriminate by deleting the tier it covers and
confirming only that assertion fails.