feat(master): added sitemap and readded ssg to contact page

This commit is contained in:
2025-07-17 17:25:09 -06:00
parent 3a5a697c95
commit be60e9b4b1
6 changed files with 60 additions and 3 deletions

13
package-lock.json generated
View File

@ -7,6 +7,9 @@
"": {
"name": "darkicewolf50",
"version": "3.0.0",
"dependencies": {
"date-fns": "^4.1.0"
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/js": "^9.31.0",
@ -2000,6 +2003,16 @@
"node": ">=4"
}
},
"node_modules/date-fns": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz",
"integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==",
"license": "MIT",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/kossnocorp"
}
},
"node_modules/debug": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",

View File

@ -30,5 +30,8 @@
"vite": "^7.0.5",
"vite-plugin-devtools-json": "^0.3.0",
"wrangler": "^4.25.0"
},
"dependencies": {
"date-fns": "^4.1.0"
}
}

View File

@ -1,7 +1,7 @@
<script>
let { children } = $props();
import Top from '$lib/components/layout/Top.svelte';
import Bottom from '$lib/components/layout/Bottom.svelte';
let { children } = $props();
</script>
<Top />

View File

@ -0,0 +1 @@
export const prerender = true;

View File

@ -1,8 +1,6 @@
<script>
import Contact from '$lib/components/contact.svelte';
export const prerender = true;
let contactName = $state('');
let contactEmail = $state('');
let contactMessage = $state('');

View File

@ -0,0 +1,42 @@
import { format } from 'date-fns';
export const GET = async () => {
const baseUrl = 'https://yourdomain.com'; // Change to your domain
const staticPages = [
'', // homepage
'contact',
'projects'
// Add other pages here
];
const urls = staticPages
.map(
(path) => `
<url>
<loc>${baseUrl}/${path}</loc>
<lastmod>${format(new Date(), 'yyyy-MM-dd')}</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>`
)
.join('');
const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="https://www.w3.org/1999/xhtml"
xmlns:mobile="https://www.google.com/schemas/sitemap-mobile/1.0"
xmlns:news="https://www.google.com/schemas/sitemap-news/0.9"
xmlns:image="https://www.google.com/schemas/sitemap-image/1.1"
xmlns:video="https://www.google.com/schemas/sitemap-video/1.1"
>
${urls}
</urlset>`;
return new Response(sitemap, {
headers: {
'Content-Type': 'application/xml'
}
});
};