Skip to content

Commit

Permalink
i can't date
Browse files Browse the repository at this point in the history
  • Loading branch information
matklad committed Sep 24, 2024
1 parent 4872972 commit 614dc44
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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",
Expand Down
14 changes: 14 additions & 0 deletions src/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>Redirecting&hellip;</title>
<link rel="canonical" href="${path}">
<script>location="${path}"</script>
<meta http-equiv="refresh" content="0; url=${path}">
<meta name="robots" content="noindex">
<h1>Redirecting&hellip;</h1>
<a href="${path}">Click here if you are not redirected.</a>
</html>`;
}

export const feed = (posts: Post[]): HtmlString => {
const entries = posts.slice(0, 10).map(feed_entry);

Expand Down

0 comments on commit 614dc44

Please sign in to comment.