Auto-expand sidebar category and add sitemap categories
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import type { RequestHandler } from './$types';
|
||||
import { calculators } from '$lib/data/calculators';
|
||||
import { calculators, categories } from '$lib/data/calculators';
|
||||
|
||||
export const GET: RequestHandler = async () => {
|
||||
const urls = calculators.map(
|
||||
const calculatorUrls = calculators.map(
|
||||
(calc) => `
|
||||
<url>
|
||||
<loc>https://howdoyouconvert.com/${calc.slug}</loc>
|
||||
@@ -11,6 +11,15 @@ export const GET: RequestHandler = async () => {
|
||||
</url>`
|
||||
);
|
||||
|
||||
const categoryUrls = Object.keys(categories).map(
|
||||
(category) => `
|
||||
<url>
|
||||
<loc>https://howdoyouconvert.com/category/${category}</loc>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>0.9</priority>
|
||||
</url>`
|
||||
);
|
||||
|
||||
const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
@@ -18,7 +27,8 @@ export const GET: RequestHandler = async () => {
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
${urls.join('')}
|
||||
${categoryUrls.join('')}
|
||||
${calculatorUrls.join('')}
|
||||
</urlset>`;
|
||||
|
||||
return new Response(sitemap, {
|
||||
|
||||
Reference in New Issue
Block a user