I have a use case and I’m not sure if there is an easy solution within the current Ember router or not, is there a way to define an optional routing param?
I would like to have a dynamic route that might have 1 or might have 2 segments, and then further routes nested inside. My idea of the structure would be something like the below (except the :topic part would be optional)
Your solution with the wildcard seems pretty reasonable.
I think the other choice if you wanted to be more static would be to repeat the routes. You can avoid repeating their implementations by re-exporting their files under their new names. Like
// app/routes/topic-without-page.js
export { default } from './topic';
(Re-exporting works for templates too.)
This is obviously more verbose than your solution, so unless you run into a problem with it I would keep it.