templates: social-meta: prefer cover image over other images

This commit is contained in:
Aditya Telange 2020-10-12 17:26:45 +05:30
parent 306889f68b
commit 23636ab326
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
3 changed files with 6 additions and 3 deletions

View File

@ -8,7 +8,7 @@
{{- else}}
<meta property="og:image" content="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}" />
{{- end}}
{{- end }}
{{- else }}
{{ with $.Params.images }}{{ range first 6 . -}}
<meta property="og:image" content="{{ . | absURL }}" />
{{ end }}{{ else -}}
@ -21,6 +21,7 @@
{{- with $.Site.Params.images -}}
<meta property="og:image" content="{{ index . 0 | absURL }}"/>
{{ end }}{{ end }}{{ end }}
{{- end }}
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
{{- if .IsPage }}

View File

@ -11,7 +11,7 @@
{{- else}}
<meta itemprop="image" content="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}" />
{{- end}}
{{- end }}
{{- else }}
{{ with $.Params.images }}{{ range first 6 . -}}
<meta itemprop="image" content="{{ . | absURL }}">
{{ end }}{{ else -}}
@ -24,6 +24,7 @@
{{- with $.Site.Params.images -}}
<meta itemprop="image" content="{{ index . 0 | absURL }}"/>
{{ end }}{{ end }}{{ end }}
{{- end }}
<!-- Output all taxonomies as schema.org keywords -->
<meta itemprop="keywords" content="{{ if .IsPage}}{{ range $index, $tag := .Params.tags }}{{ $tag }},{{ end }}{{ else }}{{ range $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}{{ end }}" />

View File

@ -5,7 +5,7 @@
{{- else }}
<meta name="twitter:image" content="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}" />
{{- end}}
{{ end }}
{{- else }}
{{- with $.Params.images -}}
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
@ -25,6 +25,7 @@
{{- end -}}
{{- end -}}
{{- end }}
{{- end }}
<meta name="twitter:title" content="{{ .Title }}"/>
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
{{ with .Site.Social.twitter -}}