website/astro.config.mjs

65 lines
1.4 KiB
JavaScript
Raw Permalink Normal View History

2024-03-26 16:36:18 +01:00
import { defineConfig } from 'astro/config';
import { i18n, filterSitemapByDefaultLocale } from "astro-i18n-aut/integration";
import sitemap from "@astrojs/sitemap";
2024-04-06 15:20:42 +02:00
import Icons from 'unplugin-icons/vite'
2024-03-27 01:51:42 +01:00
import mdx from '@astrojs/mdx';
import glsl from 'vite-plugin-glsl';
2024-03-26 16:36:18 +01:00
import svelte from "@astrojs/svelte";
2024-03-28 18:30:52 +01:00
import UnoCSS from 'unocss/astro'
2024-03-26 16:36:18 +01:00
const defaultLocale = "de";
const locales = {
en: "en", // the `defaultLocale` value must present in `locales` keys
de: "de",
};
2024-04-06 19:11:06 +02:00
const DEFAULT_LAYOUT = '@layouts/Post.astro';
function setDefaultLayout() {
return function (_, file) {
const { frontmatter } = file.data.astro;
if (!frontmatter.layout) frontmatter.layout = DEFAULT_LAYOUT;
};
}
2024-03-26 16:36:18 +01:00
// https://astro.build/config
export default defineConfig({
site: "https://max-richter.dev",
trailingSlash: "never",
2024-03-28 18:30:52 +01:00
prefetch: true,
2024-03-26 16:36:18 +01:00
build: {
format: "file",
},
2024-03-27 01:51:42 +01:00
vite: {
plugins: [
glsl(),
2024-04-06 15:20:42 +02:00
Icons({
compiler: 'svelte',
}),
2024-03-27 01:51:42 +01:00
],
},
2024-04-06 19:11:06 +02:00
markdown: {
remarkPlugins: [setDefaultLayout]
},
2024-03-26 16:36:18 +01:00
integrations: [
2024-04-06 19:11:06 +02:00
mdx(),
2024-03-26 16:36:18 +01:00
svelte(),
2024-03-28 18:30:52 +01:00
UnoCSS({
injectReset: true
}),
2024-03-26 16:36:18 +01:00
i18n({
exclude: ["pages/**/*.json.ts", "pages/api/**/*",],
locales,
defaultLocale,
}),
sitemap({
i18n: {
locales,
defaultLocale,
},
filter: filterSitemapByDefaultLocale({ defaultLocale }),
}),
]
});