52 lines
1.5 KiB
JavaScript
52 lines
1.5 KiB
JavaScript
import { defineConfig, envField } from "astro/config";
|
||
import tailwindIntegration from "@astrojs/tailwind";
|
||
import markdownIntegration from "@astropub/md";
|
||
import htaccessIntegration from "astro-htaccess";
|
||
import pagefindIntegration from "astro-pagefind";
|
||
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(),
|
||
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/" },
|
||
],
|
||
}),
|
||
pagefindIntegration(),
|
||
],
|
||
markdown: {
|
||
smartypants: false,
|
||
},
|
||
build: {
|
||
assets: "assets",
|
||
},
|
||
outDir: "./dist",
|
||
redirects: {
|
||
"/stories": "/stories/1",
|
||
},
|
||
experimental: {
|
||
env: {
|
||
schema: {
|
||
APACHE_CONFIG: envField.boolean({ context: "server", access: "public", default: false }),
|
||
PUBLISH_DRAFTS: envField.boolean({ context: "server", access: "public", default: false }),
|
||
},
|
||
},
|
||
},
|
||
});
|