seo fixes
This commit is contained in:
parent
09039f4fee
commit
cc40a43b00
|
@ -1,11 +1,15 @@
|
|||
{{- $firstH1 := partial "name.html" . }}
|
||||
{{- $title := or .Title $firstH1 $.File.ContentBaseName }}
|
||||
{{- $name := or .Params.name (print $title " - " .Site.Title) }}
|
||||
|
||||
{{- $cover := ($.Resources.ByType "image").GetMatch "{*cover*,*thumbnail*,*featured*}" -}}
|
||||
{{ $icon := resources.GetMatch (default "" .Site.Params.icon) -}}
|
||||
|
||||
{{/*=== title ===*/}}
|
||||
{{ "<!-- text -->" | safeHTML }}
|
||||
{{- with .Site.Title }}
|
||||
<meta name="application-name" property="og:site_name" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
{{- $firstH1 := partial "name.html" . }}
|
||||
{{- $title := or .Title $firstH1 $.File.ContentBaseName }}
|
||||
{{- $name := or .Params.name (print $title " - " .Site.Title) }}
|
||||
{{- if .IsHome}}
|
||||
{{- $name = or .Params.name .Site.Title }}
|
||||
{{- end }}
|
||||
|
@ -28,8 +32,6 @@
|
|||
{{- end -}}
|
||||
|
||||
{{/*=== image ===*/}}
|
||||
{{- $cover := ($.Resources.ByType "image").GetMatch "{*cover*,*thumbnail*,*featured*}" -}}
|
||||
{{ $icon := resources.GetMatch (default "" .Site.Params.icon) -}}
|
||||
{{- $staticIcon := "icon.png" | absURL -}}
|
||||
{{- with or $cover $icon }}
|
||||
{{ "<!-- image -->" | safeHTML }}
|
||||
|
@ -59,8 +61,8 @@
|
|||
{{- end -}}
|
||||
|
||||
{{/*=== published and updated ===*/}}
|
||||
{{ "<!-- time -->" | safeHTML -}}
|
||||
{{ with .Date }}
|
||||
{{- "<!-- time -->" | safeHTML }}
|
||||
{{ with .Date -}}
|
||||
<meta property="og:article:published_time" content={{ .Format "2006-01-02T03:04:05Z" | safeHTML }} />
|
||||
<meta property="article:published_time" content={{ .Format "2006-01-02T03:04:05Z" | safeHTML }} />
|
||||
{{ end -}}
|
||||
|
@ -69,7 +71,7 @@
|
|||
{{ end -}}
|
||||
|
||||
{{/*=== section and keywords ===*/}}
|
||||
{{- "<!-- keywords -->" | safeHTML }}
|
||||
{{- "<!-- keywords -->" | safeHTML -}}
|
||||
{{ with.Params.category -}}
|
||||
<meta property="article:section" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
|
@ -91,7 +93,7 @@
|
|||
"url": {{ .Site.BaseURL }}
|
||||
},
|
||||
"datePublished": {{ .Date.UTC.Format "2006-01-02T03:04:05Z" }},
|
||||
"description": {{ or .Description .Summary }},
|
||||
"description": {{ (or .Description .Summary) | plainify }},
|
||||
"wordCount": {{ .WordCount }},
|
||||
"mainEntityOfPage": {{.Permalink}},
|
||||
"dateModified": "{{ .Lastmod.UTC.Format "2006-01-02T03:04:05Z" }}",
|
||||
|
@ -114,14 +116,14 @@
|
|||
{{ "<!-- webpage metadata -->" | safeHTML }}
|
||||
<meta property="og:type" content="website" />
|
||||
<script defer type="application/ld+json">
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "WebPage",
|
||||
"name": "{{ .Title }}",
|
||||
"url": {{ .Permalink }},
|
||||
"description": "{{ or .Description .Summary }}",
|
||||
"logo": {{with $icon}}{{.Permalink}}{{else}}{{$staticIcon}}{{end}}
|
||||
}
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "WebPage",
|
||||
"name": {{ .Title }},
|
||||
"url": {{ .Permalink }},
|
||||
"description": {{ (or .Description .Summary) | plainify }},
|
||||
"logo": {{with $icon}}{{.Permalink}}{{else}}{{$staticIcon}}{{end}}
|
||||
}
|
||||
</script>
|
||||
{{- end -}}
|
||||
|
||||
|
@ -140,6 +142,6 @@
|
|||
{{- end -}}
|
||||
|
||||
{{/* robots */}}
|
||||
{{- "<!-- robots -->" | safeHTML }}
|
||||
{{ "<!-- robots -->" | safeHTML }}
|
||||
<meta name="robots" content="index,follow" />
|
||||
<meta name="googlebot" content="index,follow" />
|
Loading…
Reference in a new issue