diff --git a/.env.example b/.env.example index 39e87c1e..0e585556 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,4 @@ PUBLIC_DEV="true" +PUBLIC_BASE_URL="http://localhost:5173" PUBLIC_GTM_ID="" PUBLIC_GTAG_ID="" diff --git a/src/content/docs/environments.md b/src/content/docs/environments.md index 53756fad..92a1fcfd 100644 --- a/src/content/docs/environments.md +++ b/src/content/docs/environments.md @@ -1,5 +1,5 @@ --- -title: 'environments' +title: "environments" description: "Configure ESLint and TypeScript for Lapikit's custom syntax. Fix false positives, suppress ts(6133) warnings, and set up your editor for the best DX." --- diff --git a/src/routes/sitemap.xml/+server.ts b/src/routes/sitemap.xml/+server.ts index c9d7f2e5..0e1aa4ec 100644 --- a/src/routes/sitemap.xml/+server.ts +++ b/src/routes/sitemap.xml/+server.ts @@ -1,4 +1,5 @@ import { docsPaths } from '$lib'; +import { PUBLIC_BASE_URL } from '$env/static/public'; export const prerender = true; @@ -14,8 +15,8 @@ function toUrl(path: string) { return route || '/'; } -export async function GET({ request }) { - const baseUrl = new URL(request.url).origin; +export async function GET() { + const baseUrl = PUBLIC_BASE_URL.replace(/\/$/, ''); const routes = [...Object.keys(pageModules), ...Object.keys(markdownModules)] .map(toUrl)