73 lines
1.8 KiB
JavaScript
73 lines
1.8 KiB
JavaScript
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,
|
||
}),
|
||
},
|
||
},
|
||
});
|