AlxTheRed
AlxTheRed

Reputation: 535

Nuxt Routing: Child Pages not found

I am building a Nuxt app that uses the WordPress REST API for content. All my other routes work fine, but I'm coming unstuck when it comes to nested pages.

I'm using the following structure in my Nuxt app:

pages
--- _slug
------ index.vue

In WordPress, an example would be:

How To Get There (slug: how-to-get-there)
-- Roads & Road Safety (slug: roads-road-safety)

I must be misunderstanding how routing works as this doesn't work and I get a 404 error when attempting to access the child page.

What is the correct way to route a child page from WordPress?

Upvotes: 1

Views: 2065

Answers (1)

Hoang Subin
Hoang Subin

Reputation: 7450

I read this from guideline of Nuxt.

"To define a dynamic route with a parameter, you need to define a .vue file OR a directory prefixed by an underscore."

So it should be

pages/ 
--| _slug/ 
-----| _slug.vue

Ref: Routing in Nuxt

Upvotes: 0

Related Questions