-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathastro.config.ts
More file actions
34 lines (31 loc) · 1.08 KB
/
astro.config.ts
File metadata and controls
34 lines (31 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { defineConfig } from "astro/config";
import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";
import react from "@astrojs/react";
import node from "@astrojs/node";
import keystatic from "@keystatic/astro";
import fs from "node:fs";
import remarkPythonRefs from "./src/plugins/remark-python-refs";
// Load redirects generated by the migration script
let redirects: Record<string, string> = {};
try {
const redirectsPath = new URL("./src/data/redirects.json", import.meta.url);
const raw: Record<string, string> = JSON.parse(fs.readFileSync(redirectsPath, "utf-8"));
for (const [from, to] of Object.entries(raw)) {
redirects[from] = to;
}
} catch {
// No redirects file yet (run migration first)
}
// Blogger feed URLs → new RSS feed
redirects["/feeds/posts/default"] = "/rss.xml";
export default defineConfig({
site: process.env.SITE_URL || "http://localhost:4321",
integrations: [mdx(), sitemap(), react(), keystatic()],
output: "server",
adapter: node({ mode: "standalone" }),
markdown: {
remarkPlugins: [remarkPythonRefs],
},
redirects,
});