diff --git a/templates/base.html b/templates/base.html index f34979f..66511ef 100644 --- a/templates/base.html +++ b/templates/base.html @@ -77,7 +77,9 @@ +{%- if not preview %} +{%- endif %} diff --git a/templates/indlaeg.html b/templates/indlaeg.html index c4f8f58..19b8fad 100644 --- a/templates/indlaeg.html +++ b/templates/indlaeg.html @@ -24,10 +24,13 @@ {#- Billeder i bundlen serveres som webp; markdown bruger bare . -#} {%- set indhold = page.content %} {%- for a in page.assets %} - {%- if a is ending_with(pat=".png") or a is ending_with(pat=".jpg") or a is ending_with(pat=".jpeg") or a is ending_with(pat=".webp") or a is ending_with(pat=".avif") %} {%- set fil = a | split(pat="/") | last %} + {%- set fra = 'src="' ~ config.base_url ~ page.path ~ fil ~ '"' %} + {%- if fil is ending_with(pat=".png") or fil is ending_with(pat=".jpg") or fil is ending_with(pat=".jpeg") or fil is ending_with(pat=".webp") %} {%- set b = resize_image(path="blog/" ~ page.slug ~ "/" ~ fil, width=1200, height=10000, op="fit", format="webp", quality=80) %} - {%- set_global indhold = indhold | replace(from='src="' ~ fil ~ '"', to='src="' ~ (b.url | replace(from=config.base_url, to="")) ~ '" width="' ~ b.width ~ '" height="' ~ b.height ~ '" loading="lazy" decoding="async"') %} + {%- set_global indhold = indhold | replace(from=fra, to='src="' ~ (b.url | replace(from=config.base_url, to="")) ~ '" width="' ~ b.width ~ '" height="' ~ b.height ~ '" loading="lazy" decoding="async"') %} + {%- else %} + {%- set_global indhold = indhold | replace(from=fra, to='src="' ~ page.path ~ fil ~ '"') %} {%- endif %} {%- endfor %}