feat: add canonical spot URLs

This commit is contained in:
ik
2026-09-07 16:43:12 +07:00
parent 233c5887eb
commit 4e037eb7e8
8 changed files with 33 additions and 8 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
import type { APIRoute } from "astro";
import { api, type Activity, type DictionaryItem } from "../lib/api";
import { api, spotPath, type Activity, type DictionaryItem } from "../lib/api";
const escapeXml = (value: string) => value.replace(/[<>&'\"]/g, character => ({ "<": "&lt;", ">": "&gt;", "&": "&amp;", "'": "&apos;", '"': "&quot;" })[character] ?? character);
@@ -11,7 +11,7 @@ export const GET: APIRoute = async ({ site }) => {
paths.add("/fish"); paths.add("/waterbodies");
fishes.forEach(item => paths.add(`/fish/${item.slug}`));
waters.forEach(item => paths.add(`/waterbodies/${item.slug}`));
activity.forEach(item => paths.add(`/spots/${item.spot_id}`));
activity.forEach(item => paths.add(spotPath(item)));
activity.forEach(item => paths.add(`/waterbodies/${item.waterbody_slug}/${item.fish_slug}`));
} catch {
// A temporary API outage must not make the static part of the sitemap unavailable.