feat: SEO, PWA, and performance optimizations
- Add sitemap.xml endpoint and update robots.txt for SEO - Improve manifest.json with richer metadata and categories - Add meta tags for social sharing and accessibility - Preload critical assets and fonts for faster loading - Optimize login background image and resource hints - Enhance service worker for better caching strategies - Add security headers to server responses - Update Vite config for chunking and dependency optimization - Add logboek.md for project tracking
This commit is contained in:
29
src/routes/sitemap.xml/+server.ts
Normal file
29
src/routes/sitemap.xml/+server.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import type { RequestHandler } from '@sveltejs/kit';
|
||||
|
||||
export const GET: RequestHandler = async ({ url }) => {
|
||||
const baseUrl = url.origin;
|
||||
const lastmod = new Date().toISOString().split('T')[0]; // YYYY-MM-DD format
|
||||
|
||||
const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>${baseUrl}/</loc>
|
||||
<lastmod>${lastmod}</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>${baseUrl}/login</loc>
|
||||
<lastmod>${lastmod}</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.5</priority>
|
||||
</url>
|
||||
</urlset>`;
|
||||
|
||||
return new Response(sitemap, {
|
||||
headers: {
|
||||
'Content-Type': 'application/xml',
|
||||
'Cache-Control': 'max-age=86400' // Cache for 24 hours
|
||||
}
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user