From 180ec3f37f25e0c87f071d32b4b45e5448f45579 Mon Sep 17 00:00:00 2001 From: Cyborg Viktor <307551610+vpetersson-bot@users.noreply.github.com> Date: Tue, 4 Aug 2026 12:16:27 +0000 Subject: [PATCH] Fix enableGitInfo being silently discarded by TOML scoping enableGitInfo = true sat directly beneath the [pagination] table header. TOML assigns every bare key to the table that precedes it, so it was parsed as pagination.enableGitInfo and dropped -- `hugo config` had no root-level enablegitinfo among its 666 lines. ignoreFiles, two lines further down, was lost the same way. The setting has therefore never done anything. Not a shallow clone: the deploy workflow already uses fetch-depth: 0, the local clone has full history, and security.exec.allow already permits git. Confirmed by building with the --enableGitInfo flag, which populates .GitInfo immediately from the same working tree. The visible damage was 28 FAQ pages shipping "dateModified":"0001-01-01T00:00:00Z" in live structured data, and a sitemap with no at all. Moving both keys above the first table header gives 314 sitemap lastmod entries and real dates throughout. Three follow-on corrections, without which enabling it would have introduced new inaccuracies: - The guides TechArticle no longer takes datePublished from .Lastmod. .Lastmod is the file's latest commit, so with GitInfo live it would have restamped a guide as newly published on every edit. datePublished is now emitted only from an explicit frontmatter date; .Lastmod supplies dateModified alone. - The FAQ WebPage dateModified is guarded on .Lastmod.IsZero. That is the exact field that shipped the 28 zero dates, so it should not be able to do so again if the config regresses. - The blog post meta and BlogPosting schema are restricted to .Kind "page". The /blog/ listing and its 7 paginated pages share Type "posts" but have no date, so they were emitting BlogPosting and article:published_time with zero dates while already carrying their own CollectionPage. Their breadcrumb came from that same block, so it is re-emitted alongside the CollectionPage rather than lost. Verified against a production build. The only entity-count change is BlogPosting 99 -> 91, the eight listing pages; BreadcrumbList holds at 172 and every other type is unchanged. Zero dates across the site go 28 -> 0, invalid JSON-LD stays 0, and no entity is missing a required property. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01FbqYj6ztzG6yautDpRWDXS --- hugo.toml | 19 +++++++++----- layouts/partials/head.html | 53 +++++++++++++++++++++++++++++++------- 2 files changed, 57 insertions(+), 15 deletions(-) diff --git a/hugo.toml b/hugo.toml index 76c6e1a..e41b1a4 100644 --- a/hugo.toml +++ b/hugo.toml @@ -2,18 +2,25 @@ baseURL = "https://sbomify.com" title = "Sbomify" languageCode = "en-us" -# Pagination (matches jekyll-paginate-v2: 12 per page) -[pagination] - pagerSize = 12 - path = "page" - # Enable .GitInfo (replaces _plugins/git_dates.rb) +# +# Keep this and ignoreFiles ABOVE the first table header. TOML assigns every +# bare key to the table that precedes it, so while these sat under +# [pagination] they were parsed as pagination.enableGitInfo / +# pagination.ignoreFiles -- silently dropped by Hugo, with no root-level +# enableGitInfo in `hugo config` at all. The visible symptom was .GitInfo nil +# and .Lastmod zero on every page, which put "0001-01-01T00:00:00Z" into the +# dateModified of 28 FAQ pages. enableGitInfo = true - # Ignore leftover Jekyll files ignoreFiles = ["_config\\.yml$", "_config_development\\.yml$", "Gemfile", "Gemfile\\.lock", "convert_to_webp\\.rb$"] +# Pagination (matches jekyll-paginate-v2: 12 per page) +[pagination] + pagerSize = 12 + path = "page" + # Match Jekyll permalink exactly: /:year/:month/:day/:slug/ [permalinks] [permalinks.page] diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 2782098..cfa3a6a 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -82,7 +82,11 @@ {{- range site.Params.social.profiles -}} {{- if eq .platform "LinkedIn" -}}{{ $linkedinUrl = .url }}{{- end -}} {{- end -}} - {{ if eq .Type "posts" }} + {{/* .Kind "page" excludes the /blog/ listing and its paginated pages, which + share Type "posts" but have no date of their own — they were emitting + article:published_time "0001-01-01T00:00:00Z". They get their own + CollectionPage schema further down. */}} + {{ if and (eq .Type "posts") (eq .Kind "page") }} @@ -210,7 +214,9 @@ {{ end }} - {{ if eq .Type "posts" }} + {{/* .Kind "page" only — the /blog/ listing is not a BlogPosting, and was + emitting one with datePublished "0001-01-01T00:00:00Z". */}} + {{ if and (eq .Type "posts") (eq .Kind "page") }} + + {{/* The listing's breadcrumb used to come from the blog-post block, which is + now restricted to .Kind "page". Emitted here so /blog/ and its paginated + pages keep their trail without also claiming to be a BlogPosting. */}} + + {{ end }} {{ if eq .RelPermalink "/case-studies/" }} @@ -574,8 +607,10 @@ "name": {{ .Title | jsonify | safeJS }}, "description": {{ (.Params.description | default site.Params.description) | jsonify | safeJS }}, "url": "{{ .Permalink }}", - "dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}", - "isPartOf": { + {{/* Guarded: this is the field that shipped "0001-01-01T00:00:00Z" on 28 + FAQ pages while enableGitInfo was silently inert. */}} + {{ if not .Lastmod.IsZero }}"dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}", + {{ end }}"isPartOf": { "@type": "WebSite", "name": "{{ site.Title }}", "url": "{{ site.BaseURL }}"