this repo has no description
1// @ts-check
2import mdx from "@astrojs/mdx";
3import netlify from "@astrojs/netlify";
4import sitemap from "@astrojs/sitemap";
5import { defineConfig } from "astro/config";
6import type { InferEntrySchema } from "astro:content";
7import { readFileSync } from "node:fs";
8import katex from "rehype-katex";
9import math from "remark-math";
10import YAML from "yaml";
11
12// https://astro.build/config
13export default defineConfig({
14 devToolbar: {
15 enabled: !process.env.PLAYWRIGHT,
16 },
17
18 integrations: [
19 mdx(),
20 sitemap({
21 changefreq: "weekly",
22 // TODO wait until URLPattern lands in bun (and Node)
23 // filter: (url) => !new URLPattern("/works/:work", url).test(url)
24 filter: (url) => !new URL(url).pathname.startsWith("/works/"),
25 }),
26 ],
27
28 site: `https://${process.env.LANG}.gwen.works`,
29
30 markdown: {
31 remarkPlugins: [math],
32 rehypePlugins: [katex],
33 },
34
35 adapter: netlify(),
36 redirects: Object.fromEntries(
37 (
38 YAML.parse(
39 readFileSync("sites.yaml", "utf8"),
40 ) as InferEntrySchema<"sites">[]
41 )
42 .filter(
43 ({ url }) =>
44 URL.canParse(url) && new URL(url).protocol.match(/^https?:$/),
45 )
46 .map(({ name, url }) => [`/to/${name}`, url]),
47 ),
48});