feat(v2/seo): per-page CollectionPage JSON-LD with datePublished/dateModified

Adds a second JSON-LD block per page (a schema.org CollectionPage tied to the
existing WebSite/Organization @graph) carrying the page name, description, URL,
and datePublished / dateModified fed by the git-revision-date plugin's raw ISO
dates. Enables richer search results (article/collection rich snippets) with
real freshness dates. Template-only change (docs/overrides/main.html), applied
at build time; the homepage is skipped (it is already the WebSite entity).

Verified: every content page emits a valid CollectionPage with both dates
(e.g. Kubernetes datePublished=2026-05-18 dateModified=2026-06-20); the home
carries only the WebSite+Organization graph.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Nubenetes Bot
2026-06-20 13:51:37 +02:00
parent 1e6c7bbd9a
commit bfdec79f41

View File

@@ -50,4 +50,33 @@
]
}
</script>
{#-
Per-page structured data: a CollectionPage (each V2 page is a curated
collection of resources) tied to the WebSite/Organization above, with
datePublished / dateModified fed by the git-revision-date plugin. Enables
richer search results. Skipped on the homepage (already the WebSite entity).
-#}
{% if page and not page.is_homepage and page.canonical_url %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "CollectionPage",
"@id": {{ (page.canonical_url ~ "#webpage") | tojson }},
"url": {{ page.canonical_url | tojson }},
"name": {{ (page.title or config.site_name) | tojson }},
"isPartOf": { "@id": "https://nubenetes.com/#website" },
"publisher": { "@id": "https://nubenetes.com/#organization" },
"inLanguage": "en"
{%- if page.meta and page.meta.description %},
"description": {{ page.meta.description | tojson }}
{%- endif %}
{%- if page.meta and page.meta.git_creation_date_localized_raw_iso_date %},
"datePublished": {{ page.meta.git_creation_date_localized_raw_iso_date | tojson }}
{%- endif %}
{%- if page.meta and page.meta.git_revision_date_localized_raw_iso_date %},
"dateModified": {{ page.meta.git_revision_date_localized_raw_iso_date | tojson }}
{%- endif %}
}
</script>
{% endif %}
{% endblock %}