Update head.html

* add title tag , so search engines do not use first post's text
* add twitter tags
*
This commit is contained in:
bash-stack 2020-10-06 14:32:14 +02:00 committed by GitHub
parent 30d5681909
commit 45ff6a9e1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,8 @@
<meta name="description" content="{{ if .IsHome }}{{ .Site.Params.Subtitle }}{{ else }}{{ .Summary | plainify }}{{ end }}" /> <meta name="description" content="{{ if .IsHome }}{{ .Site.Params.Subtitle }}{{ else }}{{ .Summary | plainify }}{{ end }}" />
<meta name="keywords" content="{{ with .Params.Keywords }}{{ delimit . ", " }}{{ else }}{{ $.Site.Params.Keywords }}{{ end }}" /> <meta name="keywords" content="{{ with .Params.Keywords }}{{ delimit . ", " }}{{ else }}{{ $.Site.Params.Keywords }}{{ end }}" />
<meta name="robots" content="noodp" /> <meta name="robots" content="noodp" />
<meta name="title" content="{{ if .IsHome }}{{ $.Site.Title }}{{ else }}{{ .Title }}{{ end }}">
<link rel="canonical" href="{{ .Permalink }}" /> <link rel="canonical" href="{{ .Permalink }}" />
{{ template "_internal/google_analytics.html" . }} {{ template "_internal/google_analytics.html" . }}
@ -29,12 +31,27 @@
{{ end }} {{ end }}
<!-- Twitter Card --> <!-- Twitter Card -->
<meta name="twitter:card" content="summary" /> <meta name="twitter:card" content="summary_large_image" />
{{ if (isset $.Site.Params "twitter") }} {{ if (isset $.Site.Params "twitter") }}
<meta name="twitter:title" content="{{ if .IsHome }}{{ .Site.Params.Subtitle }}{{ else }}{{ .Summary | plainify }}{{ end }}" />
<meta name="twitter:description" content="{{ if .IsHome }}{{ .Site.Params.Subtitle }}{{ else }}{{ .Summary | plainify }}{{ end }}" />
{{ if and (not .IsHome) (isset .Params "cover") }}
<meta property="twitter:image" content="{{ .Param "cover" | absURL }}">
{{ else }}
{{ if isset $.Site.Params "favicon" }}
<meta property="twitter:image" content="{{ $.Site.Params.favicon | absURL }}">
{{ else }}
<meta property="twitter:image" content="{{ printf "img/favicon/%s.png" $.Site.Params.ThemeColor | absURL }}">
{{ end }}
{{ end }}
{{ if (isset $.Site.Params.Twitter "site") }} {{ if (isset $.Site.Params.Twitter "site") }}
<meta name="twitter:site" content="{{ $.Site.Params.Twitter.site }}" /> <meta name="twitter:site" content="{{ $.Site.Params.Twitter.site }}" />
{{ end }} {{ end }}
<meta name="twitter:creator" content="{{ if .IsHome }}{{ $.Site.Params.Twitter.creator }}{{ else if isset .Params "authortwitter" }}{{ .Params.authorTwitter }}{{ else }}{{ .Params.Author }}{{ end }}" /> <meta name="twitter:creator" content="{{ if .IsHome }}{{ $.Site.Params.Twitter.creator }}{{ else if isset .Params "authortwitter" }}{{ .Params.authorTwitter }}{{ else }}{{ .Params.Author }}{{ end }}" />
{{ end }} {{ end }}
<!-- OG data --> <!-- OG data -->