Add sitemap
This commit is contained in:
parent
fb551c651d
commit
aaa2d7ae4a
2 changed files with 43 additions and 0 deletions
41
src/routes/sitemap.xml/+server.js
Normal file
41
src/routes/sitemap.xml/+server.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
export async function GET() {
|
||||
const baseUrl = 'https://embroideryviewer.xyz';
|
||||
|
||||
const pages = [
|
||||
'',
|
||||
'about',
|
||||
'donate',
|
||||
'terms-of-service',
|
||||
'privacy-policy',
|
||||
'viewer',
|
||||
];
|
||||
|
||||
const urls = pages
|
||||
.map(
|
||||
(page) => `
|
||||
<url>
|
||||
<loc>${baseUrl}/${page}</loc>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>`,
|
||||
)
|
||||
.join('');
|
||||
|
||||
const xml = `<?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>`.trim();
|
||||
|
||||
return new Response(xml, {
|
||||
headers: {
|
||||
'Content-Type': 'application/xml',
|
||||
},
|
||||
});
|
||||
}
|
2
static/robots.txt
Normal file
2
static/robots.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
User-agent: *
|
||||
Sitemap: https://www.embroideryviewer.xyz/sitemap.xml
|
Loading…
Add table
Reference in a new issue