mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-11 03:12:56 +00:00
feat: use get_featured_image partial consistently for og:image and JSON-LD (#3311)
site_head.html, jsonld/article.html, jsonld/qapage.html, and jsonld/event.html hardcode `(.Resources.ByType "image").GetMatch "*featured*"` to find featured images. This ignores custom filenames set via `.Params.image.filename` in front matter, causing og:image and JSON-LD image to fall back to the site icon. Replace the hardcoded pattern with the `get_featured_image` partial (already used by jsonld/webpage.html), which properly searches for: 1. Files matching `*featured*` in the page directory 2. Custom filename from `.Params.image.filename` in the page directory 3. Custom filename in `assets/media/` directory Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
f972c65119
commit
611be3562f
4 files changed
+4
-4
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{{- $page := .page }}
|
||||
{{ $summary := .summary }}
|
||||
{{ $featured_image := ($page.Resources.ByType "image").GetMatch "*featured*" }}
|
||||
{{ $featured_image := partial "functions/get_featured_image" $page }}
|
||||
|
||||
{{/* Get schema type. */}}
|
||||
{{ $schema := "Article" }}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{{ $page := .page }}
|
||||
{{ $summary := .summary }}
|
||||
{{ $featured_image := ($page.Resources.ByType "image").GetMatch "*featured*" }}
|
||||
{{ $featured_image := partial "functions/get_featured_image" $page }}
|
||||
{{ $author := partial "functions/get_author_name" $page }}
|
||||
|
||||
<script type="application/ld+json">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{{- $page := .page }}
|
||||
{{ $summary := .summary }}
|
||||
{{ $featured_image := ($page.Resources.ByType "image").GetMatch "*featured*" }}
|
||||
{{ $featured_image := partial "functions/get_featured_image" $page }}
|
||||
|
||||
{{/* Get author and publisher info */}}
|
||||
{{ $author := partial "functions/get_author_name" $page }}
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
|
||||
{{/* Get page image for sharing. */}}
|
||||
{{ $sharing_image := resources.GetMatch (path.Join "media" "sharing.*") }}
|
||||
{{ $featured_image := (.Resources.ByType "image").GetMatch "*featured*" }}
|
||||
{{ $featured_image := partial "functions/get_featured_image" . }}
|
||||
{{ $avatar_image := (.Resources.ByType "image").GetMatch "avatar*" }}
|
||||
{{ $has_logo := fileExists "assets/media/logo.png" | or (fileExists "assets/media/logo.svg") }}
|
||||
{{ $og_image := "" }}
|
||||
|
||||
Reference in new issue
Block a user