aboutsummaryrefslogtreecommitdiff
path: root/main.ts
diff options
context:
space:
mode:
authornetop://ウィビ <paul@webb.page>2026-07-22 10:55:23 -0700
committernetop://ウィビ <paul@webb.page>2026-07-22 10:55:23 -0700
commit55d8b17aeccb48194cbaea9831286b4b73ac7059 (patch)
tree99b24d4037863802496745e6c1482e03809a2321 /main.ts
parentb0e6f006d06553040e7f1d9db81f003607d75d2b (diff)
downloadblog-55d8b17aeccb48194cbaea9831286b4b73ac7059.tar.gz
blog-55d8b17aeccb48194cbaea9831286b4b73ac7059.zip
fixes canonical links
Diffstat (limited to 'main.ts')
-rw-r--r--main.ts10
1 files changed, 6 insertions, 4 deletions
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"
}