Skip to content

Commit 1cb223e

Browse files
committed
feat/seo: sitemap, feat/og: add images
1 parent c26df27 commit 1cb223e

File tree

19 files changed

+41
-20
lines changed

19 files changed

+41
-20
lines changed

astro.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import tailwind from "@tailwindcss/vite";
44

55
import mdx from "@astrojs/mdx";
66
import icon from "astro-icon";
7+
import sitemap from "@astrojs/sitemap";
78
// import { visualizer } from "rollup-plugin-visualizer";
89

910
// https://astro.build/config
@@ -23,6 +24,7 @@ export default defineConfig({
2324
},
2425
}),
2526
mdx(),
27+
sitemap(),
2628
],
2729

2830
prefetch: {

bun.lock

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"name": "website",
66
"dependencies": {
77
"@astrojs/mdx": "^4.1.0",
8+
"@astrojs/sitemap": "^3.2.1",
89
"@date-fns/tz": "^1.2.0",
910
"@iconify-json/feather": "^1.2.1",
1011
"@tailwindcss/typography": "^0.5.16",
@@ -52,6 +53,8 @@
5253

5354
"@astrojs/prism": ["@astrojs/[email protected]", "", { "dependencies": { "prismjs": "^1.29.0" } }, "sha512-GilTHKGCW6HMq7y3BUv9Ac7GMe/MO9gi9GW62GzKtth0SwukCu/qp2wLiGpEujhY+VVhaG9v7kv/5vFzvf4NYw=="],
5455

56+
"@astrojs/sitemap": ["@astrojs/[email protected]", "", { "dependencies": { "sitemap": "^8.0.0", "stream-replace-string": "^2.0.0", "zod": "^3.23.8" } }, "sha512-uxMfO8f7pALq0ADL6Lk68UV6dNYjJ2xGUzyjjVj60JLBs5a6smtlkBYv3tQ0DzoqwS7c9n4FUx5lgv0yPo/fgA=="],
57+
5558
"@astrojs/telemetry": ["@astrojs/[email protected]", "", { "dependencies": { "ci-info": "^4.1.0", "debug": "^4.3.7", "dlv": "^1.1.3", "dset": "^3.1.4", "is-docker": "^3.0.0", "is-wsl": "^3.1.0", "which-pm-runs": "^1.1.0" } }, "sha512-wxhSKRfKugLwLlr4OFfcqovk+LIFtKwLyGPqMsv+9/ibqqnW3Gv7tBhtKEb0gAyUAC4G9BTVQeQahqnQAhd6IQ=="],
5659

5760
"@astrojs/yaml2ts": ["@astrojs/[email protected]", "", { "dependencies": { "yaml": "^2.5.0" } }, "sha512-GOfvSr5Nqy2z5XiwqTouBBpy5FyI6DEe+/g/Mk5am9SjILN1S5fOEvYK0GuWHg98yS/dobP4m8qyqw/URW35fQ=="],
@@ -328,6 +331,8 @@
328331

329332
"@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw=="],
330333

334+
"@types/sax": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A=="],
335+
331336
"@types/tar": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*", "minipass": "^4.0.0" } }, "sha512-IznnlmU5f4WcGTh2ltRu/Ijpmk8wiWXfF0VA4s+HPjHZgvFggk1YaIkbo5krX/zUCzWF8N/l4+W/LNxnvAJ8nw=="],
332337

333338
"@types/unist": ["@types/[email protected]", "", {}, "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="],
@@ -368,6 +373,8 @@
368373

369374
"anymatch": ["[email protected]", "", { "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" } }, "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw=="],
370375

376+
"arg": ["[email protected]", "", {}, "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg=="],
377+
371378
"argparse": ["[email protected]", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="],
372379

373380
"aria-query": ["[email protected]", "", {}, "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw=="],
@@ -1080,6 +1087,8 @@
10801087

10811088
"sass-formatter": ["[email protected]", "", { "dependencies": { "suf-log": "^2.5.3" } }, "sha512-CWZ8XiSim+fJVG0cFLStwDvft1VI7uvXdCNJYXhDvowiv+DsbD1nXLiQ4zrE5UBvj5DWZJ93cwN0NX5PMsr1Pw=="],
10821089

1090+
"sax": ["[email protected]", "", {}, "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg=="],
1091+
10831092
"semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="],
10841093

10851094
"sharp": ["[email protected]", "", { "dependencies": { "color": "^4.2.3", "detect-libc": "^2.0.3", "semver": "^7.6.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.33.5", "@img/sharp-darwin-x64": "0.33.5", "@img/sharp-libvips-darwin-arm64": "1.0.4", "@img/sharp-libvips-darwin-x64": "1.0.4", "@img/sharp-libvips-linux-arm": "1.0.5", "@img/sharp-libvips-linux-arm64": "1.0.4", "@img/sharp-libvips-linux-s390x": "1.0.4", "@img/sharp-libvips-linux-x64": "1.0.4", "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", "@img/sharp-libvips-linuxmusl-x64": "1.0.4", "@img/sharp-linux-arm": "0.33.5", "@img/sharp-linux-arm64": "0.33.5", "@img/sharp-linux-s390x": "0.33.5", "@img/sharp-linux-x64": "0.33.5", "@img/sharp-linuxmusl-arm64": "0.33.5", "@img/sharp-linuxmusl-x64": "0.33.5", "@img/sharp-wasm32": "0.33.5", "@img/sharp-win32-ia32": "0.33.5", "@img/sharp-win32-x64": "0.33.5" } }, "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw=="],
@@ -1090,6 +1099,8 @@
10901099

10911100
"sisteransi": ["[email protected]", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="],
10921101

1102+
"sitemap": ["[email protected]", "", { "dependencies": { "@types/node": "^17.0.5", "@types/sax": "^1.2.1", "arg": "^5.0.0", "sax": "^1.2.4" }, "bin": { "sitemap": "dist/cli.js" } }, "sha512-+AbdxhM9kJsHtruUF39bwS/B0Fytw6Fr1o4ZAIAEqA6cke2xcoO2GleBw9Zw7nRzILVEgz7zBM5GiTJjie1G9A=="],
1103+
10931104
"smol-toml": ["[email protected]", "", {}, "sha512-tEYNll18pPKHroYSmLLrksq233j021G0giwW7P3D24jC54pQ5W5BXMsQ/Mvw1OJCmEYDgY+lrzT+3nNUtoNfXQ=="],
10941105

10951106
"source-map": ["[email protected]", "", {}, "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA=="],
@@ -1100,6 +1111,8 @@
11001111

11011112
"sprintf-js": ["[email protected]", "", {}, "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="],
11021113

1114+
"stream-replace-string": ["[email protected]", "", {}, "sha512-TlnjJ1C0QrmxRNrON00JvaFFlNh5TTG00APw23j74ET7gkQpTASi6/L2fuiav8pzK715HXtUeClpBTw2NPSn6w=="],
1115+
11031116
"string-width": ["[email protected]", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
11041117

11051118
"stringify-entities": ["[email protected]", "", { "dependencies": { "character-entities-html4": "^2.0.0", "character-entities-legacy": "^3.0.0" } }, "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg=="],
@@ -1312,6 +1325,8 @@
13121325

13131326
"prompts/kleur": ["[email protected]", "", {}, "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w=="],
13141327

1328+
"sitemap/@types/node": ["@types/[email protected]", "", {}, "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw=="],
1329+
13151330
"tar/minipass": ["[email protected]", "", {}, "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ=="],
13161331

13171332
"vscode-json-languageservice/jsonc-parser": ["[email protected]", "", {}, "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ=="],

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
},
2020
"dependencies": {
2121
"@astrojs/mdx": "^4.1.0",
22+
"@astrojs/sitemap": "^3.2.1",
2223
"@date-fns/tz": "^1.2.0",
2324
"@iconify-json/feather": "^1.2.1",
2425
"@tailwindcss/typography": "^0.5.16",

public/favicon-64x.png

1.52 KB
Loading

public/robots.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
# Full syntax: https://developers.google.com/search/docs/advanced/robots/create-robots-txt
33
User-agent: *
44
Allow: /
5+
6+
Sitemap: https://utcode.net/sitemap-index.xml

src/components/ActivityPage/Layout.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const { type, cover } = Astro.props;
1616
title={type}
1717
description={`ut.code(); の活動内容 - ${type}`}
1818
focus={Focus.none}
19+
image={cover}
1920
>
2021
<Picture
2122
formats={["avif", "webp"]}

src/images/favicon-64x.png

1.52 KB
Loading

src/layouts/GlobalLayout.astro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@ import Footer from "../components/Footer.astro";
33
import Header from "../components/Header.astro";
44
import type { Focus } from "../schema";
55
import Meta from "./meta.astro";
6+
import Logo from "../images/favicon.png";
67
78
interface Props {
89
title: string | null;
910
description: string | null;
1011
focus: Focus;
1112
class?: string;
13+
image: ImageMetadata | null;
1214
}
13-
const { title, description, focus } = Astro.props;
15+
const { title, description, focus, image } = Astro.props;
1416
---
1517

1618
<html lang="ja" class="bg-gray-50 text-gray-800" data-theme="light">
17-
<Meta {title} {description} />
19+
<Meta {title} {description} image={image ?? Logo.src} />
1820
<body class="min-h-full w-full">
1921
<Header {focus} />
2022
<slot />

src/layouts/meta.astro

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,27 @@
11
---
2-
// import type { WithContext, Thing } from "schema-dts";
3-
import { getImage } from "astro:assets";
4-
import Favicon from "../images/favicon.png";
5-
62
interface Props {
73
title: string | null;
84
description: string | null;
95
keywords?: string[];
10-
image?: string; // URL of image
11-
// linkedData?: WithContext<Thing>;
6+
image: ImageMetadata;
127
}
138
const { title, description, keywords = [], image } = Astro.props;
149
const url = Astro.url.href;
15-
16-
const favicon = await getImage({
17-
src: Favicon,
18-
height: 32,
19-
width: 32,
20-
});
2110
---
2211

2312
<meta charset="utf-8" />
2413
<title>{title ? title + " | ut.code();" : "ut.code();"}</title>
25-
<link rel="icon" href={favicon.src} />
14+
<link rel="icon" href="/public/favicon-64x.png" />
15+
<link rel="sitemap" href="/sitemap-index.xml" />
2616
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
2717
<meta
2818
name="description"
2919
content={description ?? "東京大学のソフトウェアエンジニアリングコミュニティ"}
3020
/>
3121
<meta property="og:site_name" content="ut.code();" />
3222
<meta property="og:title" content={title} />
33-
<!-- TODO: make the origin flexible -->
34-
<meta property="og:image" content={"https://utcode.net" + image} />
35-
<meta property="og:url" content={"https://utcode.net" + url} />
23+
<meta property="og:image" content={image.src} />
24+
<meta property="og:url" content={url} />
3625
<meta property="og:locale" content="ja_JP" />
3726
<meta name="twitter:card" content="summary_large_image" />
3827
<meta name="twitter:site" content="@utokyo_code" />

src/pages/articles/[...page].astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const { page } = Astro.props;
1919
title="すべての記事"
2020
description="ut.code(); からの最新情報"
2121
focus={Focus.articles}
22+
image={null}
2223
>
2324
<main class="container mx-auto px-4 py-24">
2425
<h1 class="text-center text-4xl">すべての記事</h1>

0 commit comments

Comments
 (0)