fix: billeder i udkast og preview uden sitemap-link
Zola gør relative billedstier absolutte, så omskrivningen til webp skal matche den form. Ikke-konverterbare billeder får en rod-relativ sti, som preview kan flytte. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e58a11c2b4
commit
aeb7c88949
@@ -77,7 +77,9 @@
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
{%- if not preview %}
|
||||
<link rel="sitemap" href="/sitemap-index.xml" />
|
||||
{%- endif %}
|
||||
<link rel="alternate" type="application/rss+xml" title="{{ config.title }}" href="/rss.xml" />
|
||||
<link rel="me" href="https://mastodon.social/@asgerweirsoee" />
|
||||
<link rel="stylesheet" href="{{ get_url(path="css/site.css", cachebust=true) | replace(from=config.base_url, to="") | safe }}" />
|
||||
|
||||
@@ -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 %}
|
||||
<div class="prose mt-8">{{ indhold | safe }}</div>
|
||||
|
||||
Reference in New Issue
Block a user