diff options
author | Sangeeth Sudheer <git@sangeeth.dev> | 2025-04-25 22:09:40 +0530 |
---|---|---|
committer | Sangeeth Sudheer <git@sangeeth.dev> | 2025-04-25 22:09:40 +0530 |
commit | c782f5cfc2f06b86cd2900c9381262f41ebf67da (patch) | |
tree | beaaff0bfbb723e42273884ccc9182c6fe91fec0 | |
parent | 4b94b8da8b92c2ceeb23d674c169977f22fc486e (diff) |
Make opengraph.html a normal partial
Moves `opengraph.html` under `layout/partials` and updates `head.html`
to include from the updated path. This change is needed to make things
work with Hugo >=v0.144.0 as they moved templates like
`opengraph.html` from `_internals` breaking existing usage. The doc also recommends doing this: https://gohugo.io/templates/embedded/#open-graph
This change shouldn't affect existing users of Typo unless they override
`head.html`.
-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..94176db 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 (and (or .IsHome .IsPage) (templates.Exists "partials/head/og-image.html")) }} + {{- $ogImage := partial "head/og-image.html" . }} + {{- with $ogImage }} <meta property="og:image" content="{{ . }}"> - {{- end -}} + {{- end }} {{- end }} {{- end }} |