-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathastro.config.mjs
More file actions
49 lines (45 loc) · 1.27 KB
/
astro.config.mjs
File metadata and controls
49 lines (45 loc) · 1.27 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import sitemap from "@astrojs/sitemap";
import { defineConfig } from "astro/config";
import { toString } from "mdast-util-to-string";
import getReadingTime from "reading-time";
import rehypeSlug from "rehype-slug";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import react from "@astrojs/react";
import vercel from "@astrojs/vercel/serverless";
import tailwindcss from "@tailwindcss/vite";
function remarkReadingTime() {
return function(tree, { data }) {
const textOnPage = toString(tree);
const readingTime = getReadingTime(textOnPage);
// readingTime.text will give us minutes read as a friendly string,
// i.e. "3 min read"
data.astro.frontmatter.minutesRead = readingTime.text;
};
}
// https://astro.build/config
export default defineConfig({
site: "https://toasted.dev",
integrations: [sitemap(), react()],
vite: {
plugins: [tailwindcss()],
},
markdown: {
remarkPlugins: [remarkReadingTime],
rehypePlugins: [
rehypeSlug,
[
rehypeAutolinkHeadings,
{
properties: {
className: ["anchor"],
ariaHidden: "true",
tabIndex: -1,
ariaLabel: "Link to this heading",
},
},
],
],
},
output: "static",
adapter: vercel(),
});