Home

Issue: 2327

Unexpected behavior with dynamic nested routes

[issue link]

My intention was to create those routes:

/blog/:category/:subcategory/:postSlug
/blog/:category/:subcategory
/blog/:category
/blog

My folder structure looks like this:

folder-struct

Followed these docs: https://nuxtjs.org/guide/routing#dynamic-nested-routes
Paid attention to the tag, looking at these docs: https://nuxtjs.org/api/components-nuxt-child/

Expected behavior:
/blog shows posts
/blog/:category shows posts of a category
/blog/:category/:subcategory shows posts of a subcategory
/blog/:category/:subcategory/:postSlug shows a post

Actual behavior:
/blog shows posts (content in blog/index.vue)
/blog/:category shows posts of a category (content in blog/_categorySlug.vue)
/blog/:category/:subcategory
shows posts of a category (content in blog/_categorySlug.vue)
shows posts of a subcategory (content in blog/_categorySlug/_subCategorySlug.vue)
shows content inside blog/_categorySlug/_subCategorySlug/index.vue

/blog/:category/:subcategory/:postSlug
shows posts of a category (content in blog/_categorySlug.vue)
posts of a subcategory (content in blog/_categorySlug/_subCategorySlug.vue)
content inside blog/_categorySlug/_subCategorySlug/_postSlug.vue

Screenshot when accessed /blog/cat/sub/post
Shows posts of a category, subcategory and in the end shows the post title (there’s only a title saying “Post page” in _postSlug.vue)
post-page

Should it really work like this?

This question is available on Nuxt.js community (#c2031)