-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
46 lines (44 loc) · 1.57 KB
/
Copy pathastro.config.mjs
File metadata and controls
46 lines (44 loc) · 1.57 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
import { defineConfig } from 'astro/config';
import tailwindcss from '@tailwindcss/vite';
import sitemap from '@astrojs/sitemap';
// Define the official domain for SEO canonicals. Handle Netlify, Vercel, and manual env vars.
let site = process.env.SITE_URL || process.env.URL || (process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : null) || 'https://bingotelescope.org';
if (!site.startsWith('http')) {
site = `https://${site}`;
}
const base = (process.env.BASE_PATH ?? '/').replace(/\/$/, '') + '/';
export default defineConfig({
site,
base,
integrations: [
sitemap({
filter: (page) => !page.includes('/admin') && !page.includes('/404') && !page.includes('/team'), // TODO: remove '/team' filter when team page is re-enabled
serialize(item) {
// Home page — highest priority
if (item.url === `${site}/` || item.url === site) {
item.changefreq = 'weekly';
item.priority = 1.0;
}
// News pages — change often
else if (item.url.includes('/news')) {
item.changefreq = 'daily';
item.priority = 0.8;
}
// Main content pages
else if (/\/(about|science|instrumentation|location|team|publications|abdus|uirapuru|outreach)\/?$/.test(new URL(item.url).pathname)) {
item.changefreq = 'monthly';
item.priority = 0.7;
}
// Individual team/news pages
else {
item.changefreq = 'monthly';
item.priority = 0.5;
}
return item;
},
}),
],
vite: {
plugins: [tailwindcss()],
},
});