File tree Expand file tree Collapse file tree 3 files changed +5
-4
lines changed
Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 1010
1111<script setup lang="ts">
1212const { t } = useI18n ()
13- import { withLeadingSlash } from ' ufo'
13+ import { withLeadingSlash , joinURL } from ' ufo'
1414import type { Collections } from ' @nuxt/content'
1515
1616const route = useRoute ()
1717const { locale } = useI18n ()
18- const slug = computed (() => withLeadingSlash (String (route .params .slug )))
18+ const slug = computed (() => Array .isArray (route .params .slug ) ? route .params .slug as string [] : [route .params .slug as string ])
19+ const path = computed (() => withLeadingSlash (joinURL (... slug .value )))
1920
2021
2122const main = useStore ()
@@ -29,11 +30,11 @@ const codelist = computed(() => { return main.codelists.includes(codelistPageNam
2930const { data : page } = await useAsyncData (() => ` page-${slug .value }-${locale .value } ` , async () => {
3031 // Build collection name based on current locale
3132 const collection = (' content_' + locale .value ) as keyof Collections
32- const content = await queryCollection (collection ).path (slug .value ).first ()
33+ const content = await queryCollection (collection ).path (path .value ).first ()
3334
3435 // Optional: fallback to default locale if content is missing
3536 if (! content && locale .value !== ' en' ) {
36- return await queryCollection (' content_en' ).path (slug .value ).first ()
37+ return await queryCollection (' content_en' ).path (path .value ).first ()
3738 }
3839
3940 return content
File renamed without changes.
File renamed without changes.
You canβt perform that action at this time.
0 commit comments