improve seo

This commit is contained in:
a 2024-01-23 15:04:46 -06:00
parent add9440485
commit cc93948c7d
1 changed files with 12 additions and 8 deletions

View File

@ -1,7 +1,11 @@
{{ "<!-- title -->" | safeHTML }}
{{ $firstH1 := partial "name.html" . }}
{{ $title := or .Title $firstH1 $.File.ContentBaseName }}
{{- $firstH1 := partial "name.html" . }}
{{- $title := or .Title $firstH1 $.File.ContentBaseName }}
{{- if $title }}
<title itemprop="name">{{ $title }} - {{ .Site.Title }}</title>
{{- else }}
<title itemprop="name">{{ .Site.Title }}</title>
{{- end }}
<meta property="og:title" content="{{ $title }}" />
<meta name="twitter:title" content="{{ $title }}" />
<meta name="application-name" content="{{ .Site.Title }}" />
@ -13,7 +17,7 @@
<meta itemprop="description" content="{{.}}" />
<meta property="og:description" content="{{.}}" />
<meta name="twitter:description" content="{{.}}" />
{{ end -}}
{{ end }}
{{ "<!-- url -->" | safeHTML }}
<base href="{{ .Permalink | absURL }}">
<link rel="canonical" href="{{ .Permalink | absURL }}" itemprop="url" />
@ -55,7 +59,7 @@
{{/*=== published and updated ===*/}}
{{ "<!-- time -->" | safeHTML }}
{{- with .Date }}
{{ with .Date }}
<meta property="og:article:published_time" content={{ .Format "2006-01-02T15:04:05Z0700" | safeHTML }} />
<meta property="article:published_time" content={{ .Format "2006-01-02T15:04:05Z0700" | safeHTML }} />
{{ end -}}
@ -79,7 +83,7 @@
{
"@context": "http://schema.org",
"@type": "Article",
"headline": {{ .Title }},
"headline": {{ $title }},
"author": {
"@type": "Person",
"name": "{{ or .Params.author .Site.Params.author }}"
@ -90,15 +94,15 @@
"mainEntityOfPage": "True",
"dateModified": "{{ .Lastmod.Format "2006-01-02" }}",
"image": {
"@type": "imageObject",
"@type": "ImageObject",
"url": "{{ with or .Params.cover $cover $icon }}{{ .Permalink | absURL }}{{ end }}"
},
"publisher": {
"@type": "Person",
"name": "{{ or .Params.author .Site.Params.author .Site.Title }}",
"logo": {
"@type": "imageObject",
"url": {{with $icon}}{{.Permalink}}{{else}}{{$staticIcon}}{{end}}
"@type": "ImageObject",
"url": {{with $icon}}{{.Permalink}}{{else}}{{$staticIcon}}{{end}}
}
}
}