Skip to content

fix: skip inaccessible images to avoid build failure - #1301

Merged
CaiJimmy merged 4 commits into
CaiJimmy:masterfrom
jin-li:dev
Mar 8, 2026
Merged

fix: skip inaccessible images to avoid build failure#1301
CaiJimmy merged 4 commits into
CaiJimmy:masterfrom
jin-li:dev

Conversation

@jin-li

@jin-li jin-li commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

In the markdown, if an external image is referred like following:

![An inaccessible image](https://image.com/an_inaccessible_image.png)

and the remote image is inaccessible (remote image is broken, or just due to network issue) during the Hugo building process, the build will fail with following message:

ERROR Unable to get remote resource "https://image.com/an_inaccessible_image.png"
Built in 1849 ms
ERROR error building site: logged 1 error(s)

This happens even when the remote itself is fine, but it's just not accessible or loading very slowly during running hugo server or hugo -D to build the site.

So I propose that, in layouts/_partials/helper/image.html, show warning instead error for inaccessible remote images and so that the Hugo build can continue without broken.

  • If it's just network issue, the images will be loaded later
  • If he remote image is broken, user can fix the inaccessible image based on the warning message

@CaiJimmy CaiJimmy left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@CaiJimmy
CaiJimmy merged commit 0c941eb into CaiJimmy:master Mar 8, 2026
btxcy pushed a commit to btxcy/hugo-theme-stack that referenced this pull request Mar 9, 2026
* skip inaccessible images to avoid build failure

* undo changes to $result and $local

* fix: initialize $resource as a dictionary instead of an empty string

* feat: add external image processing timeout configuration

---------

Co-authored-by: Jimmy Cai <jimmy@cai.im>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants