-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.mjs
61 lines (59 loc) · 1.62 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
import { defineConfig } from 'astro/config'
import tailwind from '@astrojs/tailwind'
import sitemap from '@astrojs/sitemap'
import rehypeTitleFigure from 'rehype-title-figure'
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
import rehypeSlug from 'rehype-slug'
import rehypeAttrs from 'rehype-attr'
import expressiveCode from 'astro-expressive-code'
import { remarkExcerpt, remarkReadingTime } from './src/remark.mjs'
import { generateSocialImages } from './src/plugins.ts'
// https://astro.build/config
export default defineConfig({
site: getCurrentDomain(),
integrations: [
tailwind({ nesting: true }),
sitemap(),
generateSocialImages(),
expressiveCode({
themes: ['dark-plus'],
useDarkModeMediaQuery: false,
}),
],
prefetch: {
prefetchAll: true,
},
markdown: {
remarkPlugins: [remarkReadingTime, remarkExcerpt],
rehypePlugins: [
[rehypeAttrs, { properties: 'attr' }],
rehypeTitleFigure,
rehypeSlug,
[
rehypeAutolinkHeadings,
{
content: {
type: 'text',
value: '#',
},
headingProperties: { class: 'relative group' },
properties: {
ariaHidden: true,
ariaLabel: 'Header anchor',
class:
'invisible group-hover:visible absolute right-full p-1 -mt-1 text-current no-underline',
},
},
],
],
},
})
function getCurrentDomain() {
if (process.env.NETLIFY) {
if (process.env.BRANCH !== 'main') {
return process.env.DEPLOY_PRIME_URL
}
return process.env.URL
}
return 'http://localhost:4321'
}