Static GitHub Issues

[808] Question: how to make route parameter required?

prev: Custom routes with i18n
next: Pass to data to layout from page

Hi!

I want to create a route like this: path: "/article/:slug"

Where the slug is required. My directory structure is:

/pages
---/article
------/_slug.vue

and the nuxt generates: path: "/article/:slug?"

For every situation like this I create a workaround with index.vue inside pages/article with content:

<script>
  export default {
    fetch ({error}) {
      error({statusCode: 404})
    }
  }
</script>

Could I do this easier without creating error index?

And how about a path like this? /search/:page/:query

Thanks!

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c694">#c694</a>)</em></sub></div>