-
Notifications
You must be signed in to change notification settings - Fork 1
/
astro.config.ts
32 lines (30 loc) · 989 Bytes
/
astro.config.ts
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
import { defineConfig } from 'astro/config'
import sitemap from '@astrojs/sitemap'
import { visit } from 'unist-util-visit'
/**
* A custom remark plugin that adds rel="noopener noreferrer" and target="_blank" to external links.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const interceptExternalLinks = () => (tree: any) => {
visit(tree, 'element', (node) => {
if (node.tagName === 'a' && node.properties?.href?.startsWith('https')) {
node.properties.rel = ['noopener', 'noreferrer']
node.properties.target = '_blank'
}
})
}
// https://astro.build/config
export default defineConfig({
// https://docs.netlify.com/configure-builds/environment-variables/#deploy-urls-and-metadata
site: process.env.DEPLOY_PRIME_URL || 'https://afuh.dev',
integrations: [sitemap()],
compressHTML: true,
prefetch: true,
build: {
inlineStylesheets: 'auto',
},
markdown: {
gfm: false,
rehypePlugins: [interceptExternalLinks],
},
})