Skip to content

Commit 345031b

Browse files
Add constants and robots.txt
1 parent fe1ec96 commit 345031b

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

web/astro.config.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
import { defineConfig } from 'astro/config';
33
import starlight from '@astrojs/starlight';
44
import mtasaStarlightThemePlugin from '@multitheftauto/starlight-theme-mtasa';
5+
import { SITE_TITLE, SITE_URL } from './src/content.constants';
56

6-
// https://astro.build/config
77
export default defineConfig({
8+
site: SITE_URL,
89
i18n: {
910
locales: ["en", "es", "fr"],
1011
defaultLocale: "en",
@@ -18,7 +19,7 @@ export default defineConfig({
1819
mtasaStarlightThemePlugin(),
1920
],
2021
favicon: 'favicon.ico',
21-
title: 'Multi Theft Auto: Wiki',
22+
title: SITE_TITLE,
2223
logo: {
2324
replacesTitle: true,
2425
light: './src/assets/logo-black.png',

web/public/_redirects

Lines changed: 0 additions & 4 deletions
This file was deleted.

web/src/content.constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const SITE_TITLE = 'Multi Theft Auto: Wiki';
2+
export const SITE_URL = 'https://wiki.multitheftauto.com';

web/src/pages/_redirects.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { APIRoute } from 'astro';
2+
3+
const CFRedirects = `
4+
/wiki/ /
5+
/wiki/* /:splat
6+
`;
7+
8+
export const GET: APIRoute = () => {
9+
return new Response(CFRedirects);
10+
};

web/src/pages/robots.txt.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { APIRoute } from 'astro';
2+
3+
const getRobotsTxt = (sitemapURL: URL) => `
4+
User-agent: *
5+
Allow: /
6+
7+
Sitemap: ${sitemapURL.href}
8+
`;
9+
10+
export const GET: APIRoute = ({ site }) => {
11+
const sitemapURL = new URL('sitemap-index.xml', site);
12+
return new Response(getRobotsTxt(sitemapURL));
13+
};

0 commit comments

Comments
 (0)