-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.ts
More file actions
44 lines (40 loc) · 1.6 KB
/
Copy pathastro.config.ts
File metadata and controls
44 lines (40 loc) · 1.6 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
import { createRequire } from 'node:module'
import react from '@astrojs/react'
import sitemap from '@astrojs/sitemap'
import { defineConfig } from 'astro/config'
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
import rehypeSlug from 'rehype-slug'
import rehypeUnwrapImages from 'rehype-unwrap-images'
import type { LanguageRegistration } from 'shiki'
import rehypeResponsiveImages from './src/plugins/rehype-responsive-images.ts'
import remarkAudio from './src/plugins/remark-audio.ts'
const require = createRequire(import.meta.url)
const lilypondGrammar = require('./src/syntaxes/lilypond.tmLanguage.json') as LanguageRegistration
export default defineConfig({
site: 'https://pyonpyon.today',
trailingSlash: 'never',
output: 'static',
integrations: [
react(),
sitemap({
serialize(item) {
// Extract post date from URL for lastmod
// Post URLs: https://pyonpyon.today/p/YYYY-MM-<slug>
const match = /\/p\/(\d{4})-(\d{2})-/.exec(item.url)
if (match) {
// Use the year-month from the slug as an approximate lastmod
item.lastmod = new Date(`${match[1]}-${match[2]}-01`)
}
return item
},
}),
],
markdown: {
shikiConfig: {
theme: 'github-light-default',
langs: [{ ...lilypondGrammar, name: 'lilypond', aliases: ['ly'] }],
},
remarkPlugins: [remarkAudio],
rehypePlugins: [rehypeSlug, rehypeAutolinkHeadings, rehypeUnwrapImages, rehypeResponsiveImages],
},
})