mirror of
				https://github.com/Wonderfall/hugo-WonderMod.git
				synced 2025-10-31 03:45:24 +01:00 
			
		
		
		
	templates: add cover image to be linked into meta
for opengraph, schema and twitter
This commit is contained in:
		| @@ -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 }}"/> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Aditya Telange
					Aditya Telange