theme: fix URL fro opengraph #683

This commit is contained in:
Sören Weber 2023-10-11 17:41:04 +02:00
parent 490e51b72f
commit 7733deb0e1
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -1,6 +1,10 @@
{{- /* based on Hugo 0.119.0 _internal/opengraph.html but with modified title */}}
{{- $format := partial "get-format.hugo" . }}
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
{{- $basename := "index" }}
{{- if eq $outputFormat "searchpage" }}
{{- $basename = partial "BaseName.hugo" $format.RelPermalink }}
{{- end }}
{{- $page := . }}
{{- $title := .Title }}
{{- if eq $outputFormat "searchpage" }}
@ -23,7 +27,7 @@
<meta property="og:title" content="{{ $title }}">
<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:url" content="{{ .Permalink }}">
<meta property="og:url" content="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true "basename" $basename) }}">
{{- with $.Params.images }}
{{- range first 6 . }}
<meta property="og:image" content="{{ . | absURL }}">