From ef451a063b0045da39fa5f655b4ba5fa5e2f09e8 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Mon, 13 Apr 2026 09:40:10 +0100 Subject: reorganises images in capsule, symlinks to website --- website/src/pages/blog/[...slug].astro | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'website/src') diff --git a/website/src/pages/blog/[...slug].astro b/website/src/pages/blog/[...slug].astro index 28d5ec0..4fe82c2 100644 --- a/website/src/pages/blog/[...slug].astro +++ b/website/src/pages/blog/[...slug].astro @@ -31,6 +31,11 @@ const GemtextHTMLRenderer: Gemtext.Renderer = { return `

${htmlEscape(content)}

` }, link: function (url: string, alt: string): string { + url = url.replaceAll(/^\/images\//g, '/images/capsule/'); + const imgExtensions: (string | undefined)[] = ['webp', 'png', 'svg', 'gif', 'jpg', 'jpeg', 'apng'] + if (imgExtensions.includes(url.split('.').at(-1)?.toLowerCase())) { + return `${alt}`; + } return `

=> ${alt}

`; }, preformatted: function (content: string[], alt: string): string { -- cgit v1.2.3