-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathastro.config.mjs
More file actions
133 lines (131 loc) · 4.53 KB
/
astro.config.mjs
File metadata and controls
133 lines (131 loc) · 4.53 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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import tailwindcss from '@tailwindcss/vite';
import astroExpressiveCode from 'astro-expressive-code';
import icon from 'astro-icon';
import { defineConfig, fontProviders } from 'astro/config';
import siteConfig from './src/data/site';
export default defineConfig({
site: siteConfig.url,
// No /docs/* redirects — /docs/ is now a real overview hub (cards
// for every section), and each section index renders cards for its
// own child pages. Astro handles trailing-slash normalization itself.
image: {
layout: 'constrained',
responsiveStyles: true,
},
prefetch: {
prefetchAll: false,
defaultStrategy: 'hover',
},
integrations: [
icon(),
// Full EC config lives in ec.config.mjs — required to keep the <Code>
// component working (function-valued options aren't JSON-serializable
// when inlined here).
astroExpressiveCode(),
mdx(),
sitemap({
// Per-page priority + changefreq, signalling to crawlers which
// surfaces matter most. lastmod is set automatically from each
// file's mtime by @astrojs/sitemap.
serialize(item) {
const url = new URL(item.url);
const path = url.pathname;
// Homepage gets max priority + weekly cadence (release chip,
// star counts, etc. tend to refresh).
if (path === '/' || path === '') {
item.priority = 1.0;
item.changefreq = 'weekly';
}
// Top-of-funnel install / quick-start pages — high priority,
// moderate change cadence.
else if (
path.startsWith('/docs/getting-started/') ||
path === '/docs/getting-started/'
) {
item.priority = 0.9;
item.changefreq = 'monthly';
}
// Module + building-block deep-dives — main long-tail surfaces.
else if (
path.startsWith('/docs/modules/') ||
path.startsWith('/docs/building-blocks/') ||
path.startsWith('/docs/architecture/')
) {
item.priority = 0.8;
item.changefreq = 'monthly';
}
// Guides and recipes — high-quality content, refreshed over time.
else if (path.startsWith('/docs/guides/')) {
item.priority = 0.75;
item.changefreq = 'monthly';
}
// Comparison pages — high-converting + rank for "X alternative" queries.
else if (path.startsWith('/docs/compare/')) {
item.priority = 0.8;
item.changefreq = 'monthly';
}
// Cross-cutting, security, deployment — important reference.
else if (
path.startsWith('/docs/cross-cutting-concerns/') ||
path.startsWith('/docs/security/') ||
path.startsWith('/docs/deployment/') ||
path.startsWith('/docs/frontend/') ||
path.startsWith('/docs/testing/') ||
path.startsWith('/docs/cli/')
) {
item.priority = 0.7;
item.changefreq = 'monthly';
}
// Changelog gets weekly cadence — search engines love freshness.
else if (path.startsWith('/docs/changelog/')) {
item.priority = 0.5;
item.changefreq = 'weekly';
}
// Contributing / meta pages — lower priority.
else if (path.startsWith('/docs/contributing/')) {
item.priority = 0.4;
item.changefreq = 'yearly';
}
// Anything else under /docs/ — sensible default.
else if (path.startsWith('/docs/')) {
item.priority = 0.6;
item.changefreq = 'monthly';
}
return item;
},
}),
],
vite: {
plugins: [tailwindcss()],
build: { target: 'es2022' },
server: { watch: { ignored: ['**/.wrangler/**'] } },
},
fonts: [
{
provider: fontProviders.google(),
name: 'Outfit',
cssVariable: '--font-outfit',
weights: ['400', '500', '600', '700', '800'],
subsets: ['latin'],
fallbacks: ['ui-sans-serif', 'system-ui', 'sans-serif'],
},
{
provider: fontProviders.google(),
name: 'Figtree',
cssVariable: '--font-figtree',
weights: ['400', '500', '600', '700', '800'],
subsets: ['latin'],
fallbacks: ['ui-sans-serif', 'system-ui', 'sans-serif'],
},
{
provider: fontProviders.google(),
name: 'JetBrains Mono',
cssVariable: '--font-jetbrains-mono',
weights: ['400', '500', '700'],
subsets: ['latin'],
fallbacks: ['ui-monospace', 'SFMono-Regular', 'Menlo', 'Consolas', 'monospace'],
},
],
});