feat: add canonical spot URLs
This commit is contained in:
@@ -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 => ({ "<": "<", ">": ">", "&": "&", "'": "'", '"': """ })[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.
|
||||
|
||||
Reference in New Issue
Block a user