website/astro.config.mjs
Max Richter 82eb0657e2
All checks were successful
Deploy to SFTP Server / build (push) Successful in 6m11s
refactor: use markdown layouts
2024-04-06 19:11:06 +02:00

65 lines
1.4 KiB
JavaScript

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