9cf54f9459
- Extends base.html, uses shared image macro for resize_image - Refactored img shortcode to forward to macros/image.html (DRY) - News pulled via get_page from content/news.md - Notfall section skipped (was unpublished in grav) - Map call commented out until shortcode lands in Task 20
16 lines
553 B
HTML
16 lines
553 B
HTML
{# Image-rendering macro, used both by templates (directly via import)
|
|
and indirectly by the `img` shortcode (which forwards to it). #}
|
|
|
|
{% macro render(src, width, alt="", class="") %}
|
|
{%- set source_path = "static/images/" ~ src -%}
|
|
{%- set resized = resize_image(path=source_path, width=width, op="fit_width", quality=85) -%}
|
|
<img
|
|
src="{{ resized.url }}"
|
|
width="{{ resized.width }}"
|
|
height="{{ resized.height }}"
|
|
alt="{{ alt }}"
|
|
{%- if class %} class="{{ class }}"{% endif %}
|
|
loading="lazy"
|
|
>
|
|
{% endmacro render %}
|