diff --git a/src/components/PageHeader.vue b/src/components/PageHeader.vue index 94280af..fb7b648 100644 --- a/src/components/PageHeader.vue +++ b/src/components/PageHeader.vue @@ -31,12 +31,22 @@ info?: string | Array; link?: string; shortList?: boolean; + sectionType?: "list" | "discover"; } - const props = defineProps(); + const props = withDefaults(defineProps(), { + sectionType: "list" + }); const urlify = computed(() => { - return `/list/${props.title.toLowerCase().replace(" ", "_")}`; + const normalizedTitle = props.title + .toLowerCase() + .replace(/'s\b/g, "") // Remove possessive 's + .replace(/[^\w\d\s-]/g, "") // Remove special characters (keep word chars, dashes, digits, spaces) + .replace(/\s+/g, "_") // Replace spaces with underscores + .replace(/-/g, "_") // Replace dash with underscore + .replace(/_+/g, "_"); // Replace multiple underscores with single underscore + return `/${props.sectionType}/${normalizedTitle}`; }); const prettify = computed(() => { diff --git a/src/components/ResultsSection.vue b/src/components/ResultsSection.vue index 08c051c..84d695c 100644 --- a/src/components/ResultsSection.vue +++ b/src/components/ResultsSection.vue @@ -1,6 +1,8 @@