-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathastro.config.js
100 lines (96 loc) · 3.02 KB
/
astro.config.js
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
// astro.config.js
import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
// import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";
import vercel from '@astrojs/vercel/serverless';
// import vercel from '@astrojs/vercel/static';
// import { getSitemapArticles } from './src/utils/utils.js';
import svelte from '@astrojs/svelte';
import markdoc from "@astrojs/markdoc";
import site from './src/data/site.json'; // for branding
// import icon from "astro-icon";
// import minify from 'astro-min';
// import compress from "astro-compress";
// import partytown from '@astrojs/partytown';
import react from "@astrojs/react";
import db from "@astrojs/db";
const isDev = process.env.NODE_ENV === 'development';
const siteMapConfig = {
filter: url => {
// Define the base paths to include in the sitemap
const includedBasePaths = ['/', '/about/', '/contact/', '/privacy/'];
// Define the directory paths to include in the sitemap
const includedDirectories = ['/topics/', '/categories/', '/authors/'];
const pathname = new URL(url).pathname;
return includedBasePaths.includes(pathname) || includedDirectories.some(dir => pathname.startsWith(dir));
}
// additionalSitemaps: [ site.url + '/sitemap_articles.xml' ]
};
const minifyConfig = {
do_not_minify_doctype: true,
ensure_spec_compliant_unquoted_attribute_values: true,
keep_closing_tags: true,
keep_comments: false,
keep_html_and_head_opening_tags: true,
keep_input_type_text_attr: false,
keep_spaces_between_attributes: true,
keep_ssi_comments: false,
minify_css: true,
minify_js: true,
preserve_brace_template_syntax: false,
preserve_chevron_percent_template_syntax: false,
remove_bangs: false,
remove_processing_instructions: false
};
// https://astro.build/config
export default defineConfig({
site: site.url,
output: 'hybrid',
// output: 'server',
adapter: vercel({
imageService: false,
webAnalytics: {
enabled: true
}
// functionPerRoute: true, // does not work with hobby version of vercel
// serviceEntryPoint: '@astrojs/image/sharp',
// imagesConfig: {
// sizes: [120, 188, 300, 372, 788, 1000, 1280],
// formats: ["image/webp", "image/jpg"],
// },
}),
integrations: [tailwind(),
//mdx(),
sitemap(siteMapConfig), svelte(), markdoc({
allowHTML: true
}),
// icon(),
// compress(),
// minify(minifyConfig),
// partytown()
react(), db()],
experimental: {
contentCollectionCache: true,
},
prefetch: {
defaultStrategy: 'viewport',
prefetchAll: !isDev,
},
vite: {
optimizeDeps: {
exclude: ["oslo", "astro:db"]
},
build: {
// minify: false,
},
logLevel: 'info',
server: {
watch: {
ignored: ['**/node_modules/**', '**/.vscode/**', '**/.vercel/**', '**/dist/**', '**/public/**', '**/.astro/**', '.env', '.git', '.DS_Store', '.aider.chat.history.md', '.aider*','src/content/topics/*', 'src/content/categories/*', 'src/content/faqs/*',
]
},
logLevel: 'info'
}
}
});