mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-11-25 12:01:37 +01:00
templates: add cover image to be linked into meta
for opengraph, schema and twitter
This commit is contained in:
parent
6c4e094c91
commit
4a4d0c009c
@ -2,6 +2,13 @@
|
|||||||
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
|
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
|
||||||
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
|
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
|
||||||
<meta property="og:url" content="{{ .Permalink }}" />
|
<meta property="og:url" content="{{ .Permalink }}" />
|
||||||
|
{{- if .Params.cover.image -}}
|
||||||
|
{{- if (ne .Params.cover.relative true) }}
|
||||||
|
<meta property="og:image" content="{{ .Params.cover.image | absURL }}" />
|
||||||
|
{{- else}}
|
||||||
|
<meta property="og:image" content="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}" />
|
||||||
|
{{- end}}
|
||||||
|
{{- end }}
|
||||||
{{ with $.Params.images }}{{ range first 6 . -}}
|
{{ with $.Params.images }}{{ range first 6 . -}}
|
||||||
<meta property="og:image" content="{{ . | absURL }}" />
|
<meta property="og:image" content="{{ . | absURL }}" />
|
||||||
{{ end }}{{ else -}}
|
{{ end }}{{ else -}}
|
||||||
|
@ -5,6 +5,13 @@
|
|||||||
<meta itemprop="datePublished" {{ .PublishDate.Format $ISO8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
|
<meta itemprop="datePublished" {{ .PublishDate.Format $ISO8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
|
||||||
{{ if not .Lastmod.IsZero }}<meta itemprop="dateModified" {{ .Lastmod.Format $ISO8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
|
{{ if not .Lastmod.IsZero }}<meta itemprop="dateModified" {{ .Lastmod.Format $ISO8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
|
||||||
<meta itemprop="wordCount" content="{{ .WordCount }}">
|
<meta itemprop="wordCount" content="{{ .WordCount }}">
|
||||||
|
{{- if .Params.cover.image -}}
|
||||||
|
{{- if (ne .Params.cover.relative true) }}
|
||||||
|
<meta itemprop="image" content="{{ .Params.cover.image | absURL }}" />
|
||||||
|
{{- else}}
|
||||||
|
<meta itemprop="image" content="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}" />
|
||||||
|
{{- end}}
|
||||||
|
{{- end }}
|
||||||
{{ with $.Params.images }}{{ range first 6 . -}}
|
{{ with $.Params.images }}{{ range first 6 . -}}
|
||||||
<meta itemprop="image" content="{{ . | absURL }}">
|
<meta itemprop="image" content="{{ . | absURL }}">
|
||||||
{{ end }}{{ else -}}
|
{{ end }}{{ else -}}
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
{{- if .Params.cover.image -}}
|
||||||
|
<meta name="twitter:card" content="summary_large_image" />
|
||||||
|
{{- if (ne $.Params.cover.relative true) }}
|
||||||
|
<meta name="twitter:image" content="{{ .Params.cover.image | absURL }}" />
|
||||||
|
{{- else }}
|
||||||
|
<meta name="twitter:image" content="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}" />
|
||||||
|
{{- end}}
|
||||||
|
{{ end }}
|
||||||
{{- with $.Params.images -}}
|
{{- with $.Params.images -}}
|
||||||
<meta name="twitter:card" content="summary_large_image"/>
|
<meta name="twitter:card" content="summary_large_image"/>
|
||||||
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
|
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user