diff options
| author | Joe Carstairs <me@joeac.net> | 2026-04-13 09:40:10 +0100 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2026-04-13 09:40:10 +0100 |
| commit | ef451a063b0045da39fa5f655b4ba5fa5e2f09e8 (patch) | |
| tree | ad80874a7c823b54d4c285e5ad8c4102470788e8 /website/src/pages/blog | |
| parent | 1a64bce2fbf4f8c430672b63c62c6b99c0ac496a (diff) | |
reorganises images in capsule, symlinks to website
Diffstat (limited to 'website/src/pages/blog')
| -rw-r--r-- | website/src/pages/blog/[...slug].astro | 5 |
1 files changed, 5 insertions, 0 deletions
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<string> = { return `<p>${htmlEscape(content)}</p>` }, 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 `<img src="${url}" alt="${alt}" />`; + } return `<p>=> <a href="${url}">${alt}</a></p>`; }, preformatted: function (content: string[], alt: string): string { |
