-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathastro.config.mjs
49 lines (43 loc) · 1.11 KB
/
astro.config.mjs
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
import fs from 'node:fs/promises';
import rehypePrettyCode from "rehype-pretty-code";
import vercel from "@astrojs/vercel/static";
const BLOG_DIR = './src/content/blog';
const getBlogRoutesRedirect = async () => {
const blogRoutes = (await fs.readdir(BLOG_DIR)).map((file) => file.replace(/\.md$/, ''));
const slugs = blogRoutes.map((slug) => [
`/${slug}`,
`/blog/${slug}`,
]);
return Object.fromEntries(slugs);
}
// https://astro.build/config
export default defineConfig({
site: 'https://vitorsalmeida.com',
integrations: [mdx(), sitemap()],
output: "static",
adapter: vercel(),
markdown: {
syntaxHighlight: false,
remarkPlugins: [
remarkMath,
],
rehypePlugins: [
rehypeKatex,
[
rehypePrettyCode,
{
theme: 'github-light',
keepBackground: false,
},
],
],
},
redirects: {
...(await getBlogRoutesRedirect()),
}
});