-
Notifications
You must be signed in to change notification settings - Fork 320
Expand file tree
/
Copy pathastro.config.mjs
More file actions
62 lines (59 loc) · 1.82 KB
/
astro.config.mjs
File metadata and controls
62 lines (59 loc) · 1.82 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// @ts-check
import { defineConfig } from 'astro/config';
import vue from '@astrojs/vue';
import tailwindcss from '@tailwindcss/vite';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import rehypeSlug from 'rehype-slug';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import generatedRedirects from './src/build/generated-redirects.json' with { type: 'json' };
const autolinkConfig = {
behavior: 'append',
properties: {
class: 'heading-anchor',
ariaLabel: 'Link to this section',
},
};
// Build redirect config with 301 status for SEO
// Simple redirects: exact path mappings
const simpleRedirects = Object.fromEntries(
Object.entries(generatedRedirects.redirects).map(([from, to]) => [from, { destination: to, status: 301 }])
);
// Pattern redirects: dynamic route patterns (e.g. /blog/[...slug] → /news/[...slug])
const patternRedirects = Object.fromEntries(
Object.entries(generatedRedirects.patterns).map(([from, to]) => [from, { destination: to, status: 301 }])
);
// https://astro.build/config
export default defineConfig({
site: 'https://galaxyproject.org',
prefetch: {
defaultStrategy: 'hover',
},
redirects: {
...simpleRedirects,
...patternRedirects,
},
integrations: [
vue(),
mdx({
rehypePlugins: [rehypeSlug, [rehypeAutolinkHeadings, autolinkConfig]],
}),
sitemap(),
],
markdown: {
rehypePlugins: [rehypeSlug, [rehypeAutolinkHeadings, autolinkConfig]],
},
vite: {
define: {
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: true,
},
plugins: [tailwindcss()],
server: {
// Reduce inotify watcher pressure during dev/Playwright runs
watch: {
usePolling: true,
ignored: ['**/public/images/**', '**/public/assets/**', '**/public/media/**', '**/content/**/images/**'],
},
},
},
});