-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.ts
More file actions
85 lines (84 loc) · 2.28 KB
/
Copy pathastro.config.ts
File metadata and controls
85 lines (84 loc) · 2.28 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
import react from "@astrojs/react";
import sitemap from "@astrojs/sitemap";
import vercel from "@astrojs/vercel";
import { defineConfig } from "astro/config";
import { resolve } from "path";
// https://astro.build/config
export default defineConfig({
site: process.env.SITE_URL,
i18n: {
defaultLocale: "it",
locales: ["it", "en"],
routing: {
prefixDefaultLocale: true,
},
},
integrations: [
sitemap({
filter: (page) =>
!page.includes("component-inventory") &&
!page.includes("/search") &&
!page.includes("/ricerca"),
i18n: {
defaultLocale: "it",
locales: {
it: "it",
en: "en",
},
},
// Emit slash-less <loc> and hreflang URLs so the sitemap matches the
// canonical/hreflang tags (SeoHreflang.astro), which strip the trailing
// slash. Never strip the domain root ("https://host/").
serialize(item) {
const stripTrailingSlash = (url: string) =>
url.replace(/([^/])\/$/, "$1");
item.url = stripTrailingSlash(item.url);
if (item.links) {
item.links = item.links.map((link) => ({
...link,
url: stripTrailingSlash(link.url),
}));
}
return item;
},
}),
react(),
],
adapter: vercel({
edgeMiddleware: true,
}),
redirects: {
"/": {
status: 301,
destination: "/it",
},
// @astrojs/sitemap only emits sitemap-index.xml; keep the conventional
// URL working for humans and tools that expect it.
"/sitemap.xml": {
status: 301,
destination: "/sitemap-index.xml",
},
},
vite: {
define: {
// Bakes the landing/full-site mode into every bundle, including the
// serverless routes where runtime env vars are not configurable.
__SHOW_ALL_PAGES__: JSON.stringify(process.env.SHOW_ALL_PAGES === "true"),
},
ssr: {
noExternal: ["graph-italia-components"],
},
resolve: {
alias: {
"/^@(.*)$/": resolve("./src/*"),
"@splidejs/splide/src/css/core/index": resolve(
"node_modules/@splidejs/splide/src/css/core/index.scss",
),
"@bootstrap-src": "/node_modules/bootstrap-italia/src",
},
},
},
build: {
inlineStylesheets: "always",
},
});