-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.mjs
105 lines (103 loc) · 2.47 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { defineConfig } from 'astro/config'
import mdx from '@astrojs/mdx'
import react from '@astrojs/react'
import sitemap from '@astrojs/sitemap'
import tailwind from '@astrojs/tailwind'
// Rehype/Remark Plugins
import { rehypeAccessibleEmojis } from 'rehype-accessible-emojis'
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
import rehypeExternalLinks from 'rehype-external-links'
import rehypeSlug from 'rehype-slug'
import rehypePrettyCode from 'rehype-pretty-code'
import { remarkReadingTime } from './plugins/remark-reading-time'
const currentYear = new Date().getFullYear()
// https://astro.build/config
export default defineConfig({
image: {
service: {
entrypoint: 'astro/assets/services/noop',
},
},
integrations: [
react(),
tailwind(),
mdx(),
sitemap({
serialize(item) {
if (item.url === 'https://blog.codybrunner.com/') {
item.changefreq = 'weekly'
item.lastmod = new Date().toISOString()
item.priority = 1.0
return item
}
if (item.url.includes('archive')) {
item.changefreq = 'yearly'
item.lastmod = new Date().toISOString()
item.priority = 0.5
return item
}
if (item.url.includes('categories') || item.url.includes('tags')) {
item.changefreq = 'monthly'
item.lastmod = new Date().toISOString()
item.priority = 0.7
return item
}
if (!item.url.includes(currentYear)) {
item.changefreq = 'never'
item.priority = 0.1
return item
}
item.changefreq = 'monthly'
item.priority = 0.7
return item
},
}),
],
markdown: {
rehypePlugins: [
rehypeSlug,
[
rehypePrettyCode,
{
onVisitLine(line) {
// Prevent lines from collapsing in `display: grid` mode, and allow empty
// lines to be copy/pasted
if (line.children.length === 0) {
line.children = [{ type: 'text', value: ' ' }]
}
},
theme: 'material-theme-palenight',
},
],
[
rehypeAutolinkHeadings,
{
behavior: 'prepend',
content: {
properties: {
className: ['icon', 'icon-link'],
},
tagName: 'span',
type: 'element',
},
},
],
[
rehypeExternalLinks,
{
rel: ['noopener', 'noreferrer'],
target: '_blank',
},
],
rehypeAccessibleEmojis,
],
remarkPlugins: [remarkReadingTime],
// Necessary to allow for `rehype-pretty-code` to work.
syntaxHighlight: false,
},
server: {
open: true,
port: 3001,
},
site: 'https://blog.codybrunner.com',
})