diff --git a/src/routes/sitemap.xml/+server.ts b/src/routes/sitemap.xml/+server.ts new file mode 100644 index 0000000..e51aed3 --- /dev/null +++ b/src/routes/sitemap.xml/+server.ts @@ -0,0 +1,57 @@ +import type { RequestHandler } from '@sveltejs/kit'; +import { PUBLIC_SITE_URL } from '$env/static/public'; + +const site = `https://${PUBLIC_SITE_URL}`; + +export const GET: RequestHandler = async function GET({ setHeaders }) { + const xml = ` + + + ${site} + daily + 1 + + + + ${site}/about + monthly + 0.4 + + + + ${site}/articles + weekly + 1 + + + ${site}/portfolio + monthly + 0.4 + + + ${site}/privacy + monthly + 0.1 + + + ${site}/uses + monthly + 0.4 + + + `; + + setHeaders({ + 'cache-control': 'max-age=0, s-maxage=3600', + 'Content-Type': 'application/xml' + }); + + return new Response(xml); +}; diff --git a/static/robots.txt b/static/robots.txt index 6f27bb6..7d329b1 100644 --- a/static/robots.txt +++ b/static/robots.txt @@ -1,2 +1 @@ User-agent: * -Disallow: \ No newline at end of file