From 611be3562f44d8fec844d5c6b5c5615a1154bf12 Mon Sep 17 00:00:00 2001 From: Aki Ariga Date: Mon, 30 Mar 2026 12:29:18 -0700 Subject: [PATCH] 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 --- 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 d494ef61..84f27d3f 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 03629e0b..6d2be535 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 }}