From 344c357a48b896d95715d5bc9c2eb739514210cf Mon Sep 17 00:00:00 2001 From: Aki Ariga Date: Fri, 27 Mar 2026 20:12:25 -0700 Subject: [PATCH] fix: use get_featured_image partial consistently for og:image and JSON-LD 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 --- modules/blox/layouts/_partials/jsonld/article.html | 2 +- modules/blox/layouts/_partials/jsonld/event.html | 2 +- modules/blox/layouts/_partials/jsonld/qapage.html | 2 +- modules/blox/layouts/_partials/site_head.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/blox/layouts/_partials/jsonld/article.html b/modules/blox/layouts/_partials/jsonld/article.html index d494ef615..84f27d3f8 100644 --- a/modules/blox/layouts/_partials/jsonld/article.html +++ b/modules/blox/layouts/_partials/jsonld/article.html @@ -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" }} diff --git a/modules/blox/layouts/_partials/jsonld/event.html b/modules/blox/layouts/_partials/jsonld/event.html index 03629e0bd..6d2be5350 100644 --- a/modules/blox/layouts/_partials/jsonld/event.html +++ b/modules/blox/layouts/_partials/jsonld/event.html @@ -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 }}