gallery.badmanners.xyz/astro.config.mjs
2024-12-05 21:43:04 -03:00

73 lines
1.8 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig, envField } from "astro/config";
import tailwindIntegration from "@astrojs/tailwind";
import markdownIntegration from "@astropub/md";
import mdxIntegration from "@astrojs/mdx";
import htaccessIntegration from "astro-htaccess";
import pagefindIntegration from "./src/integrations/pagefind";
import alpinejsIntegration from "@astrojs/alpinejs";
import { AI_BOTS } from "./src/data/ai_bots";
// https://astro.build/config
export default defineConfig({
site: "https://gallery.badmanners.xyz",
integrations: [
tailwindIntegration({
applyBaseStyles: false,
}),
markdownIntegration(),
mdxIntegration(),
alpinejsIntegration(),
pagefindIntegration({
forceLanguage: "en",
}),
htaccessIntegration({
generateHtaccessFile: import.meta.env.APACHE_CONFIG === "true",
customRules: [
// Block AI bots
"<IfModule mod_rewrite.c>",
" RewriteEngine on",
" RewriteBase /",
` RewriteCond %{HTTP_USER_AGENT} ${AI_BOTS.map((bot) => `^${bot}$`).join("|")} [NC]`,
" RewriteRule ^ [F]",
"</IfModule>",
],
redirects: [
{
match: "/story/",
url: "/stories/",
},
{
match: "/game/",
url: "/games/",
},
],
}),
],
markdown: {
smartypants: false,
shikiConfig: {
themes: {
light: "vitesse-light",
dark: "vitesse-dark",
},
defaultColor: "light",
},
},
build: {
assets: "assets",
},
outDir: "./dist",
redirects: {
"/stories/1": "/stories",
},
env: {
schema: {
APACHE_CONFIG: envField.boolean({ context: "server", access: "public", default: false }),
PUBLISH_DRAFTS: envField.boolean({
context: "server",
access: "public",
default: false,
}),
},
},
});