fix: correct permalink casing for OpenGraph and Twitter image tags (#1324)

This commit is contained in:
powerfullz
2026-04-26 13:14:34 +02:00
committed by GitHub
parent 4f2764e0a5
commit 6f3ab760f9
3 changed files with 3 additions and 3 deletions
@@ -39,5 +39,5 @@
{{ $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources "Context" .) }} {{ $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources "Context" .) }}
{{- if $image -}} {{- if $image -}}
<meta property='og:image' content='{{ absURL $image.permalink }}' /> <meta property='og:image' content='{{ absURL $image.Permalink }}' />
{{- end -}} {{- end -}}
@@ -12,5 +12,5 @@
{{- $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources "Context" .) -}} {{- $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources "Context" .) -}}
{{- if $image -}} {{- if $image -}}
<meta name="twitter:card" content="{{ .Site.Params.opengraph.twitter.card }}"> <meta name="twitter:card" content="{{ .Site.Params.opengraph.twitter.card }}">
<meta name="twitter:image" content='{{ absURL $image.permalink }}' /> <meta name="twitter:image" content='{{ absURL $image.Permalink }}' />
{{- end -}} {{- end -}}
+1 -1
View File
@@ -52,7 +52,7 @@
{{- end -}} {{- end -}}
{{- $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources "Context" .) -}} {{- $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources "Context" .) -}}
{{- if $image -}} {{- if $image -}}
{{- $imgTag := printf "<img src=\"%s\" alt=\"Featured image of post %s\" />" ($image.permalink | absURL) .Title -}} {{- $imgTag := printf "<img src=\"%s\" alt=\"Featured image of post %s\" />" ($image.Permalink | absURL) .Title -}}
{{- $content = printf "%s%s" $imgTag $content -}} {{- $content = printf "%s%s" $imgTag $content -}}
{{- end -}} {{- end -}}
{{- $content | transform.XMLEscape | safeHTML -}} {{- $content | transform.XMLEscape | safeHTML -}}