Utilities
Depth based priority
Use this as your priorityFn to generate a priority value based on the URL depth.
import type { Types } from "@modules/cartographer/types"
export const depthBasedPriority: Types.PriorityFn = (url: string) => { // Homepage gets the highest priority if (url === "/") return 1
// Depending on the URL depth we'll assign a priority // Stopped at 3 levels, so the lowest priority is 0.7 const depth = Math.min(3, Math.max(url.split("/").length - 1, 1))
return 1 - depth / 10}