feat: allow realtive paths in images

Useful when hosting on a subdirectory. Replaces $BASE_URL by the
base_url set in config.toml.
This commit is contained in:
welpo 2023-02-10 13:25:55 +01:00
parent 4bb7435eab
commit 9de7a7a02d
No known key found for this signature in database
GPG Key ID: A2F978CF4EC1F5A6
2 changed files with 2 additions and 2 deletions

View File

@ -74,7 +74,7 @@
</section> </section>
</div> </div>
<div class="image-container-home"> <div class="image-container-home">
<img alt="the owner" class="banner-home-img" src="{{ desc.img }}" /> <img alt="the owner" class="banner-home-img" src={{ desc.img | safe | replace(from="$BASE_URL", to=config.base_url) }} />
</div> </div>
</div> </div>
{% endmacro page_desc %} {% endmacro page_desc %}

View File

@ -1 +1 @@
<img class="invertable-image" {% if src %}src="{{ src }}"{% endif %} {% if alt %}alt="{{ alt }}"{% endif %}/> <img class="invertable-image" {% if src %}src={{ src | safe | replace(from="$BASE_URL", to=config.base_url) }} {% endif %} {% if alt %}alt="{{ alt }}"{% endif %}/>