Show a build error when image is not found

Does anyone know in jekyll if there’s a way to show an error if a file isn’t found? I’ve been using {% link _posts/ %} to link other documents, and it’s super useful. I get a nice compile error if the link is broken!

Now I want to show an error if the link to an image in my post’s frontmatter is not pointing to a valid image.

e.g. inside

picture_url: /assets/stuff.png

Then in the template for the page I show the image with:

<img src="{{ page.picture_url }}"

But right now if the link is not valid it just shows a broken image. I would love to be able to find these kinds of typos more programmaticaly.

Thank you,

html-proofer can do that I think - as well as all kinds of other things:

I had it working via a gulp task at some point though that was with node and the link above is to a ruby gem I think.

Jekyll itself doesn’t have a feature like that - that I know of.

Thank you, that’s a really useful tool!