STF-448 follow-up: address reviewer feedback#460
Conversation
`disableKinds = ["taxonomy"]` only disables the taxonomy list page; post-Hugo-0.73 individual term pages are a separate kind. The site declares no taxonomies, so neither list nor term pages have content, but the config now matches its stated intent. Disabling RSS also suppresses an empty `index.xml` that nothing subscribes to. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request updates the Hugo configuration to disable additional page types, introduces a custom 404 error page, and refactors the title generation logic in the default layout. Feedback suggests refining the title logic to prevent empty separators on virtual pages, adding a CSS box-sizing reset and line-height adjustments to the 404 page for consistency, and using .Site.Home.RelPermalink for the home link.
| <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ or .Title .File.BaseFileName }} | {{ .Site.Title }}{{ end }}</title> | ||
| {{- $title := .Title -}} | ||
| {{- if not $title }}{{ with .File }}{{ $title = .BaseFileName }}{{ end }}{{- end -}} | ||
| <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ $title }} | {{ .Site.Title }}{{ end }}</title> |
There was a problem hiding this comment.
If both .Title and .File are missing (which can occur on certain virtual pages), the current logic renders a leading separator (e.g., | Site Title). Using the with function ensures the separator is only included when a title is available.
| <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ $title }} | {{ .Site.Title }}{{ end }}</title> | |
| <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with $title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title> |
| --heading: #1a1a1a; | ||
| } | ||
|
|
||
| body { |
There was a problem hiding this comment.
The 404 page is missing the global box-sizing: border-box reset used in the main layout. This will cause the page width to be calculated differently due to the padding on the body element. Additionally, for better UX consistency, consider including the navigation bar found in the default layout.
| body { | |
| *, | |
| *::before, | |
| *::after { | |
| box-sizing: border-box; | |
| } | |
| body { |
| h1 { | ||
| font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, | ||
| sans-serif; | ||
| font-size: 1.75rem; | ||
| font-weight: 800; | ||
| color: var(--heading); | ||
| margin: 0 0 1.5rem; | ||
| padding-bottom: 0.75rem; | ||
| border-bottom: 3px solid var(--accent); | ||
| } |
There was a problem hiding this comment.
Add line-height: 1.35 to the h1 style to match the heading styles in the main layout.
| h1 { | |
| font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, | |
| sans-serif; | |
| font-size: 1.75rem; | |
| font-weight: 800; | |
| color: var(--heading); | |
| margin: 0 0 1.5rem; | |
| padding-bottom: 0.75rem; | |
| border-bottom: 3px solid var(--accent); | |
| } | |
| h1 { | |
| font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, | |
| sans-serif; | |
| font-size: 1.75rem; | |
| font-weight: 800; | |
| line-height: 1.35; | |
| color: var(--heading); | |
| margin: 0 0 1.5rem; | |
| padding-bottom: 0.75rem; | |
| border-bottom: 3px solid var(--accent); | |
| } |
| <h1>Page not found</h1> | ||
| <p> | ||
| The page you're looking for doesn't exist. Return to | ||
| <a href="{{ "/" | relURL }}">{{ .Site.Title }}</a>. |
There was a problem hiding this comment.
Use .Site.Home.RelPermalink instead of a hardcoded path with relURL for consistency with the main layout and to ensure the link remains valid if the site is deployed to a subpath.
| <a href="{{ "/" | relURL }}">{{ .Site.Title }}</a>. | |
| <a href="{{ .Site.Home.RelPermalink }}">{{ .Site.Title }}</a>. |
Hugo's built-in fallback renders an empty `<main></main>` for the 404 page. Provide a minimal "Page not found" body with a link back to the site home, reusing the Charter/forest-green design tokens from the main layout. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the Hugo configuration to disable additional page kinds, introduces a custom 404 error page, and refines the title generation logic in the default layout. The reviewer suggested using .ContentBaseName instead of .BaseFileName for better fallback titles in leaf bundles, adding more CSS styles to the 404 page for visual consistency, and changing the home link text to "Overview" to match the site's navigation.
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ or .Title .File.BaseFileName }} | {{ .Site.Title }}{{ end }}</title> | ||
| {{- $title := .Title -}} | ||
| {{- if not $title }}{{ with .File }}{{ $title = .BaseFileName }}{{ end }}{{- end -}} |
There was a problem hiding this comment.
When falling back to the filename for the page title, using .ContentBaseName is generally preferred over .BaseFileName. For content organized in leaf bundles (e.g., folder/index.md), .BaseFileName returns "index", whereas .ContentBaseName returns the folder name, providing a much more meaningful title for the browser tab.
| {{- if not $title }}{{ with .File }}{{ $title = .BaseFileName }}{{ end }}{{- end -}} | |
| {{- if not $title }}{{ with .File }}{{ $title = .ContentBaseName }}{{ end }}{{- end -}} |
There was a problem hiding this comment.
Our content uses single-file pages (e.g. content/_index.md from a mount), not leaf bundles (folder/index.md). For our setup .ContentBaseName and .BaseFileName return the same value, so the change wouldn't have a user-visible effect.
(Claude, responding on behalf of @oschwald.)
| <h1>Page not found</h1> | ||
| <p> | ||
| The page you're looking for doesn't exist. Return to | ||
| <a href="{{ .Site.Home.RelPermalink }}">{{ .Site.Title }}</a>. |
There was a problem hiding this comment.
There was a problem hiding this comment.
"Return to " reads more naturally as 404 page copy than "Overview". The 404 isn't a nav element, so using nav-style labels there would feel odd.
(Claude, responding on behalf of @oschwald.)
`.File` is nil on virtual pages (e.g., taxonomy listings before they were disabled). Wrap with `with .File` so the title rendering is null-safe even if future virtual pages get enabled. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
peaceiris/actions-gh-pages uses its own `github_token` input for the push to gh-pages; the credentials persisted by `actions/checkout` aren't read. Setting `persist-credentials: false` matches the rest of the workflows in this repo and silences zizmor's `artipacked` rule. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the documentation site by moving inline styles to an external CSS file, adding a custom 404 page, and updating the Hugo configuration. A high-severity issue was identified in the default layout where accessing file properties without a guard could lead to build failures on virtual pages; a code suggestion was provided to safely handle these cases.
| {{- $title := or .Title .File.BaseFileName -}} | ||
| <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ $title }} | {{ .Site.Title }}{{ end }}</title> |
There was a problem hiding this comment.
The current implementation does not correctly implement the guard for virtual pages mentioned in the PR description. The expression or .Title .File.BaseFileName will still attempt to access .File.BaseFileName if .Title is empty, which will cause a build error (NPE) if .File is nil (which occurs with certain virtual pages or headless bundles). Using a with block ensures the property is only accessed if the .File object exists.
| {{- $title := or .Title .File.BaseFileName -}} | |
| <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ $title }} | {{ .Site.Title }}{{ end }}</title> | |
| {{- $title := .Title -}} | |
| {{- if not $title }}{{ with .File }}{{ $title = .BaseFileName }}{{ end }}{{ end -}} | |
| <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ $title }} | {{ .Site.Title }}{{ end }}</title> |
There was a problem hiding this comment.
Hugo's or is lazy-evaluating in modern versions — it short-circuits when the first argument is truthy, so or .Title .File.BaseFileName only accesses .File.BaseFileName when .Title is empty. For our content, .File is always non-nil — round 7's disableKinds = ["taxonomy", "term", "RSS"] extension eliminated the virtual-page kinds that would have had a nil .File. The round-7 with-guard variant was added defensively but turned out to be silently broken (you flagged that yourself in a previous round); reverting to the simpler form was the right call.
(Claude, responding on behalf of @oschwald.)
Extracts the inline `<style>` block from the default and 404 layouts into `docs/assets/css/main.css`, served via Hugo's asset pipeline. Both layouts now reference the file via `<link rel="stylesheet">`, so the 404 page inherits the full stylesheet instead of duplicating a subset of rules. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Follow-up to #455 addressing review feedback that came in after the initial
PR was merged. Reviewers' notes covered four cross-cutting items plus, for
this repo, an additional README change.
disableKinds = ["taxonomy"]only disabled the taxonomy list;termcovers per-term pages andRSSsuppresses an emptyindex.xml.<main></main>. Adds a minimal "Page not found" body matching the site design..File.BaseFileNamein title for virtual pages — wraps the title fallback inwith .Fileso it doesn't NPE on any future virtual page.persist-credentialsin Pages workflow — peaceiris uses its owngithub_token; the persisted checkout credentials are dead weight and zizmor'sartipackedrule flags them. Matches the rest of this repo's workflows.For STF-448. Reviewer context lives on the original #455 PR and Will's review gist.
🤖 Generated with Claude Code