Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion website_and_docs/layouts/partials/hooks/head-end.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<script src="/js/docsearch-fix.js"></script>
{{ 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.
Expand All @@ -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 }}
<script type="application/ld+json">{{ . | jsonify (dict "indent" " ") | safeJS }}</script>
{{- end }}
{{ end }}
Loading