From 614dc44cd7ff1dbbc98e5fc0b7444d0543161bf3 Mon Sep 17 00:00:00 2001 From: Alex Kladov Date: Tue, 24 Sep 2024 14:01:01 +0100 Subject: [PATCH] i can't date --- .github/workflows/ci.yml | 2 +- ...-io-uring.dj => 2024-09-23-what-is-io-uring.dj} | 0 src/main.ts | 13 ++++++++++++- src/templates.ts | 14 ++++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) rename content/posts/{2024-09-32--what-is-io-uring.dj => 2024-09-23-what-is-io-uring.dj} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee55baec..fe0edf75 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: with: deno-version: v1.x - - run: deno task build + - run: deno task build --blogroll - name: Deploy uses: peaceiris/actions-gh-pages@364c31d33bb99327c77b3a5438a83a357a6729ad # v3.4.0 diff --git a/content/posts/2024-09-32--what-is-io-uring.dj b/content/posts/2024-09-23-what-is-io-uring.dj similarity index 100% rename from content/posts/2024-09-32--what-is-io-uring.dj rename to content/posts/2024-09-23-what-is-io-uring.dj diff --git a/src/main.ts b/src/main.ts index ef2fa199..013299e4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -36,13 +36,16 @@ async function main() { i++; break; } + case "--blogroll": { + params.blogroll = true; + break; + } default: fatal(`unexpected argument: ${Deno.args[i]}`); } } if (subcommand === "build") { - params.blogroll = true; await build(params); } else if (subcommand === "watch") { await watch(params); @@ -140,6 +143,14 @@ async function build(params: { await update_file(`out/res/${page}.html`, templates.page(page, html).value); } + const redirects = [ + ["/2024/09/32/-what-is-io-uring.html", "/2024/09/23/what-is-io-uring.html"] + ]; + + for (const [from, to] of redirects) { + await update_file(`out/res/${from}`, templates.redirect(to).value); + } + const paths = [ "favicon.svg", "favicon.png", diff --git a/src/templates.ts b/src/templates.ts index 44188845..0ba94bf2 100644 --- a/src/templates.ts +++ b/src/templates.ts @@ -204,6 +204,20 @@ function yyyy_mm_dd(date: Date): string { return date.toISOString().slice(0, 10); } +export const redirect = (path: string): HtmlString => { + return html` + + + Redirecting… + + + + +

Redirecting…

+ Click here if you are not redirected. +`; +} + export const feed = (posts: Post[]): HtmlString => { const entries = posts.slice(0, 10).map(feed_entry);