feat: support page bundle images in OpenGraph metadata#892
feat: support page bundle images in OpenGraph metadata#892imfing merged 3 commits intoimfing:mainfrom
Conversation
✅ Deploy Preview for hugo-hextra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Can you change the file to non-executable:
chmod 644 layouts/_partials/opengraph.html
|
Should be fixed |
imfing
left a comment
There was a problem hiding this comment.
Review Summary
This is a useful enhancement that adds support for page bundle images in OpenGraph metadata. The implementation is clean and maintains backward compatibility.
Strengths
✅ Enables using images from page bundles (Hugo's recommended pattern for organizing content)
✅ Maintains backward compatibility with existing absolute/site-level paths
✅ Removes dead code ($featured variable that was always empty)
✅ Improves code formatting and consistency
Suggestions for Improvement
1. Add Documentation
Please update docs/content/docs/guide/configuration.md to document this new capability. Example:
```yaml
In a page bundle (content/mypage/index.md with myimage.jpg in same directory)
params:
images:
- "myimage.jpg" # Will use page bundle resource if it exists
- "/images/fallback.jpg" # Falls back to site-level image
```
2. Create Example/Test Page
Consider adding a test page bundle in the docs to demonstrate this feature working in practice.
3. Enhance Code Comments
The existing comments are good, but could be slightly more descriptive about the precedence order:
```html
```
Technical Notes
- The precedence (page resource first, then site-level) is the correct and expected behavior
- The performance impact of checking
$.Resources.GetMatchshould be negligible - The logic handles the common use case where users want to keep images co-located with their content
Recommendation: Approve with documentation improvements
Great work on this enhancement! It aligns well with Hugo best practices for content organization.
I'm unsure if this is a good idea, but I've made some changes to the opengraph.html layouyt so that it can use page bundle images for individual pages.
It keeps the image structure a bit less confusing if you are using page bundles resources for images on individual pages.
It's vibe coded, but seems to function as expected on my page.