This repository has been archived on 2026-05-22. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blowfish/layouts/partials/schema.html
T
Eric Gusmao 7c127074f9 fix: migrate deprecated Hugo v0.158.0 language API
Replace deprecated config keys and template methods per Hugo v0.158.0:

Config (10 files):
- languageCode → locale
- languageName → label

Templates:
- site.LanguageCode → site.Language.Locale (baseof.html, head.html, schema.html x2)
- site.Language.Lang → site.Language.Name (single.html)
- .Lang → .Language.Name (likes.html, views.html)

Ref: https://discourse.gohugo.io/t/deprecations-in-v0-158-0/56869
2026-03-25 11:15:20 -03:00

74 lines
2.5 KiB
HTML

{{ if .IsHome -}}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebSite",
"@id": {{ site.Home.Permalink | safeURL }},
"name": "{{ .Site.Title | safeJS }}",
{{ with .Site.Params.description }}"description": "{{ . | safeJS }}",{{ end }}
{{ with .Site.Language.Locale }}"inLanguage": "{{ . }}",{{ end }}
"url": {{ site.Home.Permalink | safeURL }},
{{ with .Site.Params.keywords }}"keywords": {{ . }},{{ end }}
"publisher" : {
"@type": "Person",
"name": "{{ .Site.Params.Author.name | safeJS }}"
}
}
</script>
{{ else }}
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
<script type="application/ld+json">
[{
"@context": "https://schema.org",
"@type": "Article",
"articleSection": "{{ (site.GetPage .Section).Title | safeJS }}",
"name": "{{ .Title | safeJS }}",
"headline": "{{ .Title | safeJS }}",
{{ with .Description }}"description": "{{ . | safeJS }}",{{ end }}
{{ with .Site.Language.Locale }}"inLanguage": "{{ . }}",{{ end }}
"url" : {{ .Permalink }},
"author" : {
"@type": "Person",
"name": "{{ .Site.Params.Author.name | safeJS }}"
},
{{ with .PublishDate }}"copyrightYear": "{{ .Format "2006" }}",{{ end }}
{{ with .Date }}"dateCreated": "{{ .Format $iso8601 }}",{{ end }}
{{ with .PublishDate }}"datePublished": "{{ .Format $iso8601 }}",{{ end }}
{{ with .ExpiryDate }}"expires": "{{ .Format $iso8601 }}",{{ end }}
{{ with .Lastmod }}"dateModified": "{{ .Format $iso8601 }}",{{ end }}
{{ if .Keywords }}
{{ with .Keywords }}"keywords": {{ . }},{{ end }}
{{ else }}
{{ with .Params.tags }}"keywords": {{ . }},{{ end }}
{{ end }}
"mainEntityOfPage": "true",
"wordCount": "{{ .WordCount }}"
}{{ if site.Params.enableStructuredBreadcrumbs | default false }},
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{{- $position := 0 -}}
{{- range .Ancestors -}}
{{- if not .IsHome -}}
{{- $position = add $position 1 -}}
{
"@type": "ListItem",
"position": {{ $position }},
"name": "{{ .Title }}",
"item": {{ .Permalink }}
},
{{- end -}}
{{- end -}}
{{- $position = add $position 1 -}}
{
"@type": "ListItem",
"position": {{ $position }},
"name": "{{ .Title }}",
"item": {{ .Permalink }}
}
]
}{{ end }}]
</script>
{{ end }}