Skip to content

fix: use get_featured_image partial consistently for og:image and JSON-LD#3311

Open
chezou wants to merge 1 commit intoHugoBlox:mainfrom
chezou:fix/use-get-featured-image-consistently
Open

fix: use get_featured_image partial consistently for og:image and JSON-LD#3311
chezou wants to merge 1 commit intoHugoBlox:mainfrom
chezou:fix/use-get-featured-image-consistently

Conversation

@chezou
Copy link
Copy Markdown
Contributor

@chezou chezou commented Mar 28, 2026

๐Ÿš€ What type of change is this?

  • ๐Ÿ› Bug fix (A non-breaking change that fixes an issue)
  • โœจ New feature (A non-breaking change that adds functionality)
  • ๐Ÿ’… Style change (A change that only affects formatting, visuals, or styling)
  • ๐Ÿ“š Documentation update (Changes to documentation only)
  • ๐Ÿงน Refactor or chore (A code change that neither fixes a bug nor adds a feature)
  • ๐Ÿ’ฅ Breaking change (A fix or feature that would cause existing functionality to not work as expected)

๐ŸŽฏ What is the purpose of this change?

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

๐Ÿ“ธ Screenshots or Screencast (if applicable)

Before:

image

After:

image

(URL in the post: https://chezo.uno/post/2026-03-28-montreal%E3%81%AB10%E5%B9%B4%E4%BB%A5%E4%B8%8A%E3%81%B5%E3%82%8A%E3%81%AB%E8%A1%8C%E3%81%A3%E3%81%9F/ )


โ„น๏ธ Documentation Check

  • No, this change does not require a documentation update.
  • Yes, I have updated the documentation accordingly (or will in a follow-up PR).

๐Ÿ“œ Contributor Agreement

Thank you for your contribution!

โ€ฆN-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 <noreply@anthropic.com>
@chezou chezou requested a review from gcushen as a code owner March 28, 2026 03:23
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 28, 2026

โœ… Deploy Preview for academic-demo canceled.

Name Link
๐Ÿ”จ Latest commit 344c357
๐Ÿ” Latest deploy log https://app.netlify.com/projects/academic-demo/deploys/69c749bef2cbda0008783050

@github-actions
Copy link
Copy Markdown
Contributor

Wow, your first PR! Welcome to the community! ๐ŸŽ‰

Thank you for this contribution to open source and open research. It makes a huge impact for the thousands of innovators building with Hugo Blox.

If you're wondering about next steps, please read our Contributor Guide for coding standards, how to run the project locally, and how to get help.

We hope this is just the start of your journey with us. Let's build the future together! Join us on Discord to connect with the team and community.

Awesome work, we'll take a look soon! โœจ

@chezou
Copy link
Copy Markdown
Contributor Author

chezou commented Mar 29, 2026

Per Github Copilot with GPT-5.4, the CI failures are unrelated with my change.

Here is the brief analysis by GPT-5.4:
This CI failure looks unrelated to the featured-image change in this PR. The failing matrix job is in templates/dev-portfolio, where content/_index.md references devicon/amazonwebservices-wordmark, which appears missing and becomes fatal under --panicOnWarning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant