Skip to content

Commit 0b713b5

Browse files
Fix: Correctly link images on build
This fixes an issue where images added with the `image` shortcode are visible via `zola serve` but not `zola build`. It works by prepending the site's base URL to image names so `http://127.0.0.1:1111/flower.png` and `https://www.awesomesite.com/flower.png` are both valid paths. Right now, only the former is a valid path. Fixes pawroman#36.
1 parent 9347dda commit 0b713b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

templates/shortcodes/image.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{% if src %}
2-
<img src="{{ src | safe }}"{% if alt %} alt="{{ alt }}"{% endif %} class="{% if position %}{{ position }}{% else -%} center {%- endif %}" {%- if style %} style="{{ style | safe }}" {%- endif %} />
2+
<img src="{{ config.base_url ~ src | safe }}"{% if alt %} alt="{{ alt }}"{% endif %} class="{% if position %}{{ position }}{% else -%} center {%- endif %}" {%- if style %} style="{{ style | safe }}" {%- endif %} />
33
{% endif %}

0 commit comments

Comments
 (0)