cinqcinqdev-seo 0.1.43 → 0.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -14
- package/dist/module.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -567,33 +567,38 @@ Auth state is read from `useSupabaseUser()` provided by `@nuxtjs/supabase`. Your
|
|
|
567
567
|
|
|
568
568
|
## Rendering Pages on the Frontend
|
|
569
569
|
|
|
570
|
-
Pages created in the CMS must be rendered by your Nuxt app.
|
|
570
|
+
Pages created in the CMS must be rendered by your Nuxt app.
|
|
571
571
|
|
|
572
|
-
###
|
|
572
|
+
### Required route file: `pages/[...slug].vue`
|
|
573
573
|
|
|
574
|
-
|
|
574
|
+
Slugs can contain slashes (e.g. `faq/my-question` when a subdirectory is set). A standard `[slug].vue` file **only matches a single path segment** — it will never match `/faq/my-question` and will return 404.
|
|
575
575
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
576
|
+
You must use a **catch-all** route:
|
|
577
|
+
|
|
578
|
+
| File | Matches |
|
|
579
|
+
|---|---|
|
|
580
|
+
| `pages/[...slug].vue` ✅ | `/about`, `/faq/pricing`, `/services/web-design` |
|
|
581
|
+
| `pages/[slug].vue` ❌ | `/about` only — `/faq/pricing` returns 404 |
|
|
582
|
+
|
|
583
|
+
> **If you already have `pages/[slug].vue`**, rename it to `pages/[...slug].vue` and update the slug reference as shown below. Both flat slugs and subdirectory slugs will continue to work.
|
|
581
584
|
|
|
582
|
-
###
|
|
585
|
+
### `pages/[...slug].vue`
|
|
583
586
|
|
|
584
587
|
```vue
|
|
585
588
|
<script setup>
|
|
586
589
|
const route = useRoute()
|
|
587
590
|
const supabase = useSupabaseClient()
|
|
588
591
|
|
|
589
|
-
//
|
|
590
|
-
|
|
592
|
+
// route.params.slug is an array of path segments — join them back into the DB slug
|
|
593
|
+
// e.g. /faq/pricing → ['faq', 'pricing'] → 'faq/pricing'
|
|
594
|
+
// e.g. /about → ['about'] → 'about'
|
|
595
|
+
const slug = (route.params.slug as string[]).join('/')
|
|
591
596
|
|
|
592
|
-
const { data: page } = await useAsyncData(`page-${slug
|
|
597
|
+
const { data: page } = await useAsyncData(`page-${slug}`, async () => {
|
|
593
598
|
const { data } = await supabase
|
|
594
599
|
.from('pages')
|
|
595
600
|
.select('*')
|
|
596
|
-
.eq('slug', slug
|
|
601
|
+
.eq('slug', slug)
|
|
597
602
|
.eq('status', 'published')
|
|
598
603
|
.single()
|
|
599
604
|
return data
|
|
@@ -621,7 +626,9 @@ useSeoMeta({
|
|
|
621
626
|
|
|
622
627
|
### How subdirectory slugs are stored
|
|
623
628
|
|
|
624
|
-
When a page is created with subdirectory `faq` and title `What is pricing`, the slug
|
|
629
|
+
When a page is created with subdirectory `faq` and title `What is pricing`, the slug stored in the database is `faq/what-is-pricing`. The frontend URL is `/faq/what-is-pricing`. There is no nested table or parent record — the slash is just part of the slug string.
|
|
630
|
+
|
|
631
|
+
Pages without a subdirectory (e.g. title `About`, no subdirectory) get a plain slug like `about` and are served at `/about` — exactly as before.
|
|
625
632
|
|
|
626
633
|
---
|
|
627
634
|
|
package/dist/module.json
CHANGED