-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
73 lines (64 loc) · 2.06 KB
/
astro.config.mjs
File metadata and controls
73 lines (64 loc) · 2.06 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
// @ts-check
import { defineConfig } from 'astro/config';
import tailwindcss from '@tailwindcss/vite';
import preact from '@astrojs/preact';
import sitemap from '@astrojs/sitemap';
// https://astro.build/config
export default defineConfig({
site: 'https://boring-math.com/',
// Consistent trailing slash handling for better SEO
trailingSlash: 'never',
vite: {
plugins: [tailwindcss()],
build: {
// Improve chunk splitting for better caching
rollupOptions: {
output: {
manualChunks: {
'preact-vendor': ['preact', 'preact/hooks', 'preact/compat'],
},
},
},
},
},
integrations: [
preact({ compat: true }), // Enable React compatibility
sitemap({
filter(page) {
return !page.includes('/embed/');
},
serialize(item) {
// Set priority based on page depth
if (item.url === 'https://boring-math.com/') {
item.priority = 1.0;
item.changefreq = 'weekly';
} else if (item.url.match(/\/calculators\/(automotive|brewing|business|engineering|events|everyday|finance|health|hobbies|home|income|uk-tax|us-tax)$/)) {
item.priority = 0.9;
item.changefreq = 'weekly';
} else if (item.url.includes('/calculators/')) {
item.priority = 0.8;
item.changefreq = 'monthly';
} else {
item.priority = 0.5;
item.changefreq = 'monthly';
}
return item;
},
}),
],
// Note: /privacy is redirected to /privacy-policy at the edge via
// public/_redirects (Cloudflare). Astro-level redirects emit a static
// HTML stub with <meta robots noindex>, which GSC flagged as
// "Excluded by 'noindex' tag" on a sitemap-discovered URL.
build: {
// Cloudflare Pages needs directory-style output for nested extensionless
// routes like /calculators/401k-calculator to resolve reliably.
format: 'directory',
},
output: 'static',
// Prefetch links for faster navigation
prefetch: {
prefetchAll: true,
defaultStrategy: 'hover',
},
});