fix(image): name the page a missing image was referenced from - #2153
Merged
Conversation
A missing vector image was reported with a bare warnf carrying only the src. On a site of any size that is not actionable: the log says a file is missing and nothing says which page referenced it, so finding the offending shortcode means grepping content by hand. Routes both diagnostics through LogMsg, as the invalid-arguments case in this partial already does. Each now carries the partial, the page, the src, and a warning id — so Hugo prints the ignoreLogs line that suppresses it, and a site can silence one class without silencing the rest. Registers params.debugging.failOnMissingImage, which escalates the missing case to a build failure. Defaults to false, so no existing site changes behavior; referencing an image supplied outside the build is legitimate. mod-utils GetImage reads the same flag for raster images, so the setting means one thing across both. The unsupported-media-type case reuses GetImage's existing warn-unsupported-image id rather than inventing a second one, and is never escalated: the file resolves, so it is a content error rather than a missing asset. Verified against exampleSite. Before, three broken references produced `WARN Cannot find vector image resource: "<src>"` with no page and no id; after, each names zz-missing-image-probe.md and prints its ignoreLogs hint. A mode="true" pair reports both expanded filenames, not one. With failOnMissingImage set the build exits 1; unset it exits 0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for gethinode-demo ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
v6.12.0 is the release of gethinode/mod-utils#367, which reads the same params.debugging.failOnMissingImage flag registered here and applies it to raster images. Pinning it makes the setting mean one thing across both paths rather than failing the build for vector sources only. Verified against the released module rather than the local replace used while developing the pair: with the flag set, a missing SVG and a missing raster now report ERROR from image-dimension.html and GetImage.html respectively and the build exits 1; unset, exampleSite builds clean at exit 0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
markdumay
enabled auto-merge
September 3, 2026 11:06
Collaborator
Author
|
🎉 This PR is included in version 3.23.10 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A missing vector image was reported with a bare
warnfcarrying only the src:On a site of any size that is not actionable — the log says a file is missing and nothing says which page referenced it, so finding the offending shortcode means grepping content by hand. It also has no warning id, so it cannot be suppressed with
ignoreLogsthe way every other Hinode warning can.Both diagnostics now route through
LogMsg, exactly as the invalid-arguments case a few lines above already does:params.debugging.failOnMissingImageNew, defaulting to false — no existing site changes behavior. Referencing an image supplied outside the build (a CDN path, a deploy-time asset) is legitimate, so making this fatal by default would break working sites on upgrade.
gethinode/mod-utils#367 reads the same flag for raster images, so the setting means one thing across both repos. That PR should land and release first; the vector half of this one works independently of it.
Scope notes
GetImage's existingwarn-unsupported-imageid rather than inventing a second one, so a singleignoreLogsentry covers both. It is never escalated byfailOnMissingImage: the file resolves, so it is a content error, not a missing asset.GetImage— I initially added a second report for them and removed it after the build showed my branch never fired. This PR does not touch that path.Verification
exampleSite, with a probe page carrying a missing plain SVG, a missing
mode="true"pair, and a missing raster:WARN Cannot find vector image resource: "<src>"ignoreLogs = [warn-missing-image]mode="true"pairfailOnMissingImagesetERROR×4, exit 1failOnMissingImageunsetThe mode-pair result is worth calling out: both
-lightand-darkare reported, so no extra call site is needed in the expansion path.🤖 Generated with Claude Code