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:
Torbjørn Pedersen
2026-01-04 18:25:53 +01:00
committed by GitHub
parent a128fabaf1
commit 1391ebe04b

View File

@@ -23,19 +23,21 @@
{{- with $.Params.images -}} {{- with $.Params.images -}}
{{- range first 6 . }} {{- 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 }}"> <meta property="og:image" content="{{ . | absURL }}">
{{ end -}} {{- end }}
{{- else -}} {{- end }}
{{- $featured := "" }}
{{- with $featured -}}
<meta property="og:image" content="{{ $featured.Permalink }}">
{{- else -}} {{- else -}}
{{- with $.Site.Params.images }} {{- with $.Site.Params.images }}
<meta property="og:image" content="{{ index . 0 | absURL }}"> <meta property="og:image" content="{{ index . 0 | absURL }}">
{{ end -}} {{- end }}
{{- end -}}
{{- end -}} {{- end -}}
{{- if .IsPage }} {{- if .IsPage }}
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
<meta property="article:section" content="{{ .Section }}"> <meta property="article:section" content="{{ .Section }}">