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 }}