diff options
author | Francesco Tomaselli <tomaselli.fr@gmail.com> | 2025-04-26 13:02:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-26 13:02:32 +0200 |
commit | 968e55b308755f6be652a401e0d7d1bc3b17c127 (patch) | |
tree | 3b3f77a702f81225c968a05eff9e1adee213269a | |
parent | 4b94b8da8b92c2ceeb23d674c169977f22fc486e (diff) | |
parent | 1790b5684ca8da26894dcb5d0cd7c12163f08a61 (diff) |
Merge pull request #128 from runofthemillgeek/refactor/make-opengraph-normal-partial
Make opengraph.html a normal partial
-rw-r--r-- | layouts/partials/head.html | 2 | ||||
-rw-r--r-- | layouts/partials/opengraph.html (renamed from layouts/_internal/opengraph.html) | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index f62f983..272a9ed 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -36,7 +36,7 @@ <link rel="canonical" href="{{ .Permalink }}"/> -{{ template "_internal/opengraph.html" . }} +{{ template "partials/opengraph.html" . }} {{ partialCached "head/css.html" . }} {{ partialCached "head/js.html" . }} diff --git a/layouts/_internal/opengraph.html b/layouts/partials/opengraph.html index dfe7b08..d770df1 100644 --- a/layouts/_internal/opengraph.html +++ b/layouts/partials/opengraph.html @@ -44,7 +44,7 @@ {{- range . | first 6 }} <meta property="og:image" content="{{ .Permalink }}"> {{- end }} -{{- else -}} +{{- else }} {{- /* Source modified to load `assets/images/og-image.{webp,png,jpg}` files if any of them exists. @@ -52,11 +52,11 @@ as using an external service. */ -}} - {{- if (and (or .IsHome .IsPage) (templates.Exists "partials/head/og-image.html")) -}} - {{- $ogImage := partial "head/og-image.html" . -}} - {{- with $ogImage -}} + {{- if templates.Exists "partials/head/og-image.html" }} + {{- $ogImage := partial "head/og-image.html" . | strings.TrimSpace }} + {{- with $ogImage }} <meta property="og:image" content="{{ . }}"> - {{- end -}} + {{- end }} {{- end }} {{- end }} |