nuxt-community/nuxtent-module

Links with trailing slash don't work

liquidvisual opened this issue · 4 comments

First of all, great library! Thanks for making this.

I've noticed when navigating to pages generated with markdown, they become invalid with a trailing slash. Pages don't exhibit this behaviour though.

eg:

localhost:3000/hello-world     --> Works (content/hello-world.md)
localhost:3000/hello-world/    --> Fails (content/hello-world.md)

although:

localhost:3000/about/  --> Works (pages/about.vue)
This feature request is available on Nuxt.js community (#c96)

Ye the content path must not be getting matched if it includes a trailing slash

Is there any way to fix this?

You can remove trailing slash from path passing to your asyncData function.

Based on this example:

https://github.com/nuxt-community/nuxtent-module/blob/master/examples/multiple-content-types/pages/projects/_slug/index.vue#L12

replace this line with:

project: await app.$content('/projects').get(route.path.replace(/\/$/, ''))

FIxed in c86e33a