mirror of
				https://github.com/pawroman/zola-theme-terminimal.git
				synced 2025-10-31 16:10:24 +01:00 
			
		
		
		
	 f8026666f3
			
		
	
	
		f8026666f3
		
			
		
	
	
	
	
		
			
			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 #36.
		
			
				
	
	
		
			8 lines
		
	
	
	
		
			445 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			8 lines
		
	
	
	
		
			445 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
| {% if src %}
 | |
|   {# If the image's URL is internal to the site... #}
 | |
|   {% if src is not starting_with("http") %}
 | |
|     {# ... then prepend the site's base URL to the image's URL. #}
 | |
|     {% set src = config.base_url ~ src %}
 | |
|   {% endif %}
 | |
|   <img src="{{ src | safe }}"{% if alt %} alt="{{ alt }}"{% endif %} class="{% if position %}{{ position }}{% else -%} center {%- endif %}" {%- if style %} style="{{ style | safe }}" {%- endif %} />
 | |
| {% endif %}
 |