oliverdavies.uk/astro.config.mjs
Oliver Davies de7aa271f2 feat: generate redirects in Astro
The only thing I couldn't get working were `articles/*` to `blog/*`
redirects, but those haven't been used for a long time and can be
re-attempted another time.
2023-10-04 01:43:20 +01:00

30 lines
770 B
JavaScript

import alpinejs from "@astrojs/alpinejs";
import mdx from "@astrojs/mdx";
import redirects from "./redirects.json";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
import { defineConfig } from "astro/config";
// https://astro.build/config
export default defineConfig({
integrations: [
alpinejs(),
mdx(),
sitemap({
serialize(item) {
// To prevent crawling errors, remove the trailing slash from the URL
// otherwise it will be a link to a redirect URL and not the content.
item.url = item.url.replace(/\/$/, "");
return item;
},
}),
tailwind({
config: {
applyBaseStyles: false,
},
}),
],
redirects,
site: "https://www.oliverdavies.uk",
});