Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically disable dynamic route components from handling index routes #13

Open
weotch opened this issue Apr 25, 2022 · 0 comments
Open

Comments

@weotch
Copy link
Member

weotch commented Apr 25, 2022

For instance, we don't want /pages/products/_product/_variant.vue to handle /products. I think this is a sane default, I can't think of many instances where the detail component also handles the listing view.

We currently handle this with something like:

# nuxt.config.coffee
export default

	# Customize the routes
	router: extendRoutes: (routes) ->

		# Make the slug required on these routes so the listing pages can
		# be towers
		detailRoutes = [ 'articles-article', 'recipes-recipe' ]
		for route in routes
			if route.name in detailRoutes
			then route.path = route.path.slice(0, -1)

I think this functionality gets added to https://github.com/BKWLD/cloak-boilerplate/blob/master/modules/routing.js and it just removes the ? at the end of all routes except _tower.vue so that dynamic parts are never optional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant