-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: shortcode images don't load after build #37
Conversation
This fixes an issue where images added with the [`image` shortcode](https://github.com/pawroman/zola-theme-terminimal#image) are visible via `zola serve` but not `zola build`. It works by [prepending](https://tera.netlify.app/docs#concatenation) the site's base URL to external image URLs so `https://www.awesomesite.com/flower.png` is just as valid as `http://127.0.0.1:1111/flower.png`. External images are differentiated from internal images by the presence of `http` at the beginning of their URL. Fixes issue pawroman#36.
This works by prepending the site's `base_url` to internal image paths. Image URLs are deemed to be external if they begin with `http`. This fix was added to a PR for the Terminimal theme. PR: pawroman/zola-theme-terminimal#37
Thanks for the fix! |
My pleasure. Thanks for an awesome theme! :) |
Came across this while updating my site, turns out this change actually breaks relative image URLs 😬 Basically I am using |
Sorry to hear that @ipetkov and thanks for reporting. I have created an issue to track this. Will look into it in my spare time (which might actually take a while 😅 ) |
No worries and no rush on this y'all! I have my commit pinned so my site isn't actually "broken" atm, just wanted to note the behavior change! 😄 Happy to follow the issue until it's addressed |
Issue
This fixes an issue where images added with the
image
shortcode are visible viazola serve
but notzola build
.Solution
It works by prepending the site's base URL to external image URLs so
https://www.awesomesite.com/flower.png
is just as valid ashttp://127.0.0.1:1111/flower.png
.External images are differentiated from internal images by the presence of
http
at the beginning of their URL.Fixes issue #36.