From 55d8b17aeccb48194cbaea9831286b4b73ac7059 Mon Sep 17 00:00:00 2001 From: "netop://ウィビ" Date: Wed, 22 Jul 2026 10:55:23 -0700 Subject: fixes canonical links --- main.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'main.ts') diff --git a/main.ts b/main.ts index c3dbcc9..805d070 100644 --- a/main.ts +++ b/main.ts @@ -156,7 +156,8 @@ const server = Deno.serve({ } if (/^\/(WM-\d*)$/.test(pathname)) { - const slug = pathname.slice(1) + ".txt"; + const rawSlug = pathname.slice(1); + const slug = rawSlug + ".txt"; const posts = await getDocuments(memoDirectory); if (posts && posts.indexOf(slug) < 0) { @@ -172,7 +173,7 @@ const server = Deno.serve({ const listings = await getDirectoryContents(memoDirectory); return new Response( - createLayout("memo", await populateDocument({ filename: slug }), populateRecents(listings, slug)), { + createLayout("memo", await populateDocument({ filename: slug }), populateRecents(listings, slug), rawSlug), { headers: { "content-type": "text/html; charset=utf-8" } @@ -206,7 +207,8 @@ const server = Deno.serve({ } if (/^\/remarks\/(WR-\d*)$/.test(pathname)) { - const slug = pathname.split("/").pop() + ".txt"; + const rawSlug = pathname.split("/").pop(); + const slug = rawSlug + ".txt"; const posts = await getDocuments(remarkDirectory); if (posts && posts.indexOf(slug) < 0) { @@ -222,7 +224,7 @@ const server = Deno.serve({ const listings = await getDirectoryContents(remarkDirectory); return new Response( - createLayout("remark", await populateDocument({ filename: slug }), populateRecents(listings, slug)), { + createLayout("remark", await populateDocument({ filename: slug }), populateRecents(listings, slug), rawSlug), { headers: { "content-type": "text/html; charset=utf-8" } -- cgit v1.2.3