feat: support page bundle images in OpenGraph metadata (#892)
* Support page bundle images in OpenGraph metadata * Fix file permissions --------- Co-authored-by: Xin <5097752+imfing@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
a128fabaf1
commit
1391ebe04b
@@ -23,19 +23,21 @@
|
||||
|
||||
{{- with $.Params.images -}}
|
||||
{{- range first 6 . }}
|
||||
{{- with $.Resources.GetMatch . }}
|
||||
<!-- If the string matches a page resource, use that -->
|
||||
<meta property="og:image" content="{{ .Permalink }}">
|
||||
{{- else }}
|
||||
<!-- Otherwise treat it as a site/global path -->
|
||||
<meta property="og:image" content="{{ . | absURL }}">
|
||||
{{ end -}}
|
||||
{{- else -}}
|
||||
{{- $featured := "" }}
|
||||
{{- with $featured -}}
|
||||
<meta property="og:image" content="{{ $featured.Permalink }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else -}}
|
||||
{{- with $.Site.Params.images }}
|
||||
<meta property="og:image" content="{{ index . 0 | absURL }}">
|
||||
{{ end -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{- if .IsPage }}
|
||||
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
|
||||
<meta property="article:section" content="{{ .Section }}">
|
||||
|
||||
Reference in New Issue
Block a user