-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.ts
More file actions
40 lines (35 loc) · 1015 Bytes
/
Copy pathastro.config.ts
File metadata and controls
40 lines (35 loc) · 1015 Bytes
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
import { type RemarkPlugin, unified } from "@astrojs/markdown-remark"
import mdx from "@astrojs/mdx"
import sitemap from "@astrojs/sitemap"
import tailwindcss from "@tailwindcss/vite"
import { defineConfig } from "astro/config"
import { getSiteUrl } from "./src/config/site"
const parsePublishTime: RemarkPlugin = () => (_tree, file) => {
const maybeDateString = /\d+-\d+-\d+/.exec(file.path)
let authorOffsetDate = null
if (maybeDateString) {
const [dateString] = maybeDateString
authorOffsetDate = new Date(
`${dateString}T00:00:00.000-08:00`,
).toISOString()
}
const data = file.data as {
astro: { frontmatter: { date: string | null } }
}
data.astro.frontmatter.date = authorOffsetDate
}
export default defineConfig({
markdown: {
processor: unified({
remarkPlugins: [parsePublishTime],
}),
shikiConfig: {
theme: "slack-ochin",
},
},
site: getSiteUrl(),
integrations: [mdx(), sitemap()],
vite: {
plugins: [tailwindcss()],
},
})