Skip to content

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

Merged
gcushen merged 1 commit into
HugoBlox:mainfrom
chezou:fix/use-get-featured-image-consistently
Mar 30, 2026
Merged

fix: use get_featured_image partial consistently for og:image and JSON-LD#3311
gcushen merged 1 commit into
HugoBlox: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.

@gcushen gcushen merged commit 611be35 into HugoBlox:main Mar 30, 2026
11 of 13 checks passed
@gcushen
Copy link
Copy Markdown
Collaborator

gcushen commented Mar 30, 2026

@chezou thanks for contributing :)

@chezou chezou deleted the fix/use-get-featured-image-consistently branch March 30, 2026 20:13
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.

2 participants