From b675dfc7af9f1420dca91b6f334244fee5da47f8 Mon Sep 17 00:00:00 2001 From: AutomatedTester Date: Mon, 10 Aug 2026 13:23:18 +0100 Subject: [PATCH] Add schema.org JSON-LD structured data Docsy calls Hugo's _internal/schema.html, which emits only a handful of sparse microdata meta tags. Search engines and retrieval systems get no explicit signal about what kind of page they are looking at, who publishes it, or when it was last updated. Emits one JSON-LD block per page: - WebSite on the home page - TechArticle for documentation pages - BlogPosting for blog posts, with datePublished and author All three carry an Organization publisher and inLanguage, so the four language variants are described accurately. dateModified comes from .Lastmod, which is already backed by git commit dates via enableGitInfo, making freshness explicit rather than something a crawler has to guess. Co-Authored-By: Claude Opus 5 --- .../layouts/partials/hooks/head-end.html | 52 ++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/website_and_docs/layouts/partials/hooks/head-end.html b/website_and_docs/layouts/partials/hooks/head-end.html index 2a239c648f6..b1514b710c8 100644 --- a/website_and_docs/layouts/partials/hooks/head-end.html +++ b/website_and_docs/layouts/partials/hooks/head-end.html @@ -5,7 +5,9 @@ {{ end }} {{/* - Canonical and hreflang links. Docsy emits neither for HTML pages. + Canonical and hreflang links, and schema.org structured data. Docsy emits no + canonical link and no hreflang alternates, and its call to Hugo's + _internal/schema.html produces only sparse microdata. Skipped for the "print" output format, whose pages already get a canonical link pointing back at the HTML page from Docsy's own alternate-format loop. @@ -30,4 +32,52 @@ {{- end }} {{- end }} {{- end }} + +{{- $publisher := dict + "@type" "Organization" + "name" "Selenium" + "url" .Site.BaseURL + "logo" (dict "@type" "ImageObject" "url" (absURL "images/selenium_logo_square_green.png")) + "sameAs" (slice + "https://github.com/SeleniumHQ/selenium" + "https://www.linkedin.com/company/4826427/" + "https://x.com/SeleniumHQ" + "https://www.youtube.com/@SeleniumHQProject/") -}} +{{- $ld := false -}} +{{- if .IsHome -}} + {{- $ld = dict + "@context" "https://schema.org" + "@type" "WebSite" + "name" .Site.Title + "url" .Site.BaseURL + "description" .Site.Params.description + "inLanguage" .Language.Lang + "publisher" $publisher -}} +{{- else if eq .Section "documentation" -}} + {{- $ld = dict + "@context" "https://schema.org" + "@type" "TechArticle" + "headline" .Title + "url" .Permalink + "inLanguage" .Language.Lang + "dateModified" (.Lastmod.Format "2006-01-02") + "publisher" $publisher + "isPartOf" (dict "@type" "WebSite" "name" .Site.Title "url" .Site.BaseURL) -}} + {{- with .Description }}{{ $ld = merge $ld (dict "description" .) }}{{ end -}} +{{- else if eq .Section "blog" -}} + {{- $ld = dict + "@context" "https://schema.org" + "@type" "BlogPosting" + "headline" .Title + "url" .Permalink + "inLanguage" .Language.Lang + "datePublished" (.Date.Format "2006-01-02") + "dateModified" (.Lastmod.Format "2006-01-02") + "publisher" $publisher -}} + {{- with .Description }}{{ $ld = merge $ld (dict "description" .) }}{{ end -}} + {{- with .Params.author }}{{ $ld = merge $ld (dict "author" (dict "@type" "Person" "name" .)) }}{{ end -}} +{{- end }} +{{- with $ld }} + +{{- end }} {{ end }}