commit 3c5a771d4c255814d218cb9d74a0b864623a60ef
parent d6843c5383f61fbc586deb5a4f7cb9e1253ff489
Author: Michael Neuper <michael@michaelneuper.com>
Date: Thu, 29 Oct 2026 09:35:38 +0200
add canonical URLs to each page
Diffstat:
4 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
@@ -9,7 +9,7 @@ npm install
npm run dev
```
-To check the version Netlify will deploy:
+To check the version Cloudflare will deploy:
```sh
npm run build # writes the site to dist/
@@ -33,7 +33,7 @@ npm run preview # serves dist/ at http://localhost:4321
| `src/scripts/home/`, `post/`, `demos/` | what each component and demo does in the browser |
| `src/styles/` | the styles, laid out like the components; `themes.css` has the colours |
| `src/fonts/` | JetBrains Mono and Computer Modern, built into `/_astro/` with a hash in each name so browsers can cache them for a year |
-| `public/` | files served as they are: favicon, GPG key, `robots.txt`, post videos |
+| `public/` | files served as they are: favicons and iPhone icons, GPG key, `robots.txt`, post videos |
Each component imports its own styles and starts its own script, so a section's
markup, CSS and JavaScript are named after it in `components/`, `styles/` and `scripts/`.
diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro
@@ -22,6 +22,8 @@ interface Props {
mode: string;
/** Where "Skip to content" goes. */
skip: string;
+ /** Whether to name this page's michaelneuper.com address as the real one. The 404 page has no address of its own. */
+ canonical?: boolean;
}
const {
@@ -31,6 +33,7 @@ const {
buf,
mode,
skip,
+ canonical = true,
} = Astro.props;
---
<!doctype html>
@@ -40,7 +43,9 @@ const {
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>{title}</title>
<meta name="description" content={description}>
+{canonical && <link rel="canonical" href={new URL(Astro.url.pathname, Astro.site)}>}
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
+<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="alternate" type="application/rss+xml" title="Michael Neuper's posts" href="/index.xml">
<link rel="preload" href={monoFont} as="font" type="font/woff2" crossorigin>
<link rel="preload" href={serifFont} as="font" type="font/woff2" crossorigin>
diff --git a/src/pages/404.astro b/src/pages/404.astro
@@ -4,7 +4,7 @@ import Buffer from "../components/frame/Buffer.astro";
import StatusBits from "../components/missing/StatusBits.astro";
import Dungeon from "../components/missing/Dungeon.astro";
---
-<Base title="Not found - Michael Neuper" buf="*Messages*" mode="Messages" skip="#missing">
+<Base title="Not found - Michael Neuper" buf="*Messages*" mode="Messages" skip="#missing" canonical={false}>
<Fragment slot="head">
<script is:inline>
// Hide the bits until src/scripts/missing/status-bits.js has flipped some, so 404 never shows whole first.
diff --git a/wrangler.jsonc b/wrangler.jsonc
@@ -4,6 +4,10 @@
// Must match the Worker's name in the Cloudflare dashboard.
"name": "website",
"compatibility_date": "2026-10-01",
+ // Only michaelneuper.com serves the site. A copy at website.michaelneuper.workers.dev
+ // would compete with it in search results. Every deploy applies this, so it can't be
+ // switched back on from the dashboard by accident.
+ "workers_dev": false,
"assets": {
"directory": "./dist",
"not_found_handling": "404-page"