-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.mjs
30 lines (25 loc) · 929 Bytes
/
astro.config.mjs
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
// @ts-ignore
import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind';
import sitemap from "@astrojs/sitemap";
import { site, defaultLocale } from './src/constants';
const matches = import.meta.glob('/src/assets/i18n/**/translation.json', { eager: true });
const translations = Object.values(matches);
const translationsKeys = translations.map(({lang_key}) => lang_key)
const locales = translations.reduce((acc, cur) => ({ ...acc, [cur.lang_key]: cur.lang_key }), {})
// https://astro.build/config
export default defineConfig({
site,
trailingSlash: 'never',
i18n: {
defaultLocale,
locales: translationsKeys
},
integrations: [tailwind(), sitemap({
filter: (page) => page !== `${site}/`,
i18n: {
defaultLocale, // All urls that don't contain `es` or `fr` after `https://stargazers.club/` will be treated as default locale, i.e. `en`
locales,
},
})]
});