Add SEO improvements: canonical, hreflang, schema fixes, robots.txt
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
- Fix breadcrumb schema position bug (3 → 2) for Google Rich Results - Override article/post schemas to use post image instead of site logo - Fix og:type to emit "article" on post pages with published/modified times - Add canonical link and hreflang alternate tags (incl. x-default) for bilingual site - Add organizationName/organizationLogo params for valid Organization schema - Add robots.txt with sitemap pointer - Add preconnect hint for analytics host
This commit is contained in:
parent
eca951d47e
commit
c8ff5c1d68
9 changed files with 164 additions and 20 deletions
47
layouts/partials/seo/structured/post.html
Normal file
47
layouts/partials/seo/structured/post.html
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<script type="application/ld+json"> {
|
||||
"@context" : "http://schema.org",
|
||||
"@type" : "BlogPosting",
|
||||
{{ if .Params.categories }}{{ range .Params.categories }}"articleSection" : "{{ . }}",{{ end }}{{ end }}
|
||||
"name" : "{{ .Title | safeJS }}",
|
||||
"headline" : "{{ .Title | safeJS }}",
|
||||
"mainEntityOfPage": {
|
||||
"@type": "WebPage",
|
||||
"@id": "{{ .Permalink }}"
|
||||
},
|
||||
"description" : "{{ if .Description }}{{ .Description | plainify }}{{ else }}{{if .IsPage}}{{ .Summary | plainify }}{{ end }}{{ end }}",
|
||||
"inLanguage" : "{{ .Lang }}",
|
||||
{{ if .Params.author -}}
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"name": "{{ .Params.author }}"
|
||||
},
|
||||
{{- else if .Site.Params.author.name -}}
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"name": "{{ .Site.Params.author.name }}"
|
||||
},
|
||||
{{- end }}
|
||||
"copyrightYear" : "{{ .Site.Params.since }} - {{ .Site.Lastmod.Format "2006" }}",
|
||||
{{ if not .PublishDate.IsZero -}}
|
||||
"datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}",
|
||||
{{- else if not .Date.IsZero -}}
|
||||
"datePublished": "{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}",
|
||||
{{- end }}
|
||||
{{ with .Lastmod -}}
|
||||
"dateModified": "{{ .Format "2006-01-02T15:04:05-07:00" | safeHTML }}",
|
||||
{{- end }}
|
||||
"url" : "{{ .Permalink }}",
|
||||
"wordCount" : "{{ .WordCount }}",
|
||||
"image" : "{{ .Params.share_img | default .Params.image | default .Site.Params.logo | absURL }}",
|
||||
"keywords" : [ "{{ range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}" ],
|
||||
"publisher" : {
|
||||
"@type": "Organization",
|
||||
"name" : "{{ .Site.BaseURL }}",
|
||||
"logo" : {
|
||||
"@type" : "ImageObject",
|
||||
"url" : "{{ .Site.Params.logo | absURL }}",
|
||||
"height" : 60 ,
|
||||
"width" : 60
|
||||
}
|
||||
}
|
||||
} </script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue