I was able to achieve this url format using routes.yml:
collections:
/topic/all/:
permalink: /topic/{slug}/
template: index
filter: primary_tag:topic
Now, in order to have an article in https://mydomain.com/topic, I simply created a new page with the contents that should go in there.
Where I am stuck at:
I’ve got the routes to work properly. However, when I went to https://mydomain.com/topic/all I only see posts that fir the conditions. Is there any way that I can get the page I created to show up?
Did you set the correct primary tag (this is the first tag in the list) in the new page you created?
Are you trying to set up several collections that divide your site content up into different topics?
Collections are a filtered subset of content on your site - so the collection index page will only show posts that match the filter criteria. A post can also only exist in one collection. If you need something more flexible then you might want to use channels instead.
I’d recommend reading through the routing docs which gives lots of example use cases.
There will be a hub page that will give a summary of what the topic is about - which will be in URL https://mydomain.com/topic created as a page.
There will be several articles that will all go in detail about the said topic - which will be in the URL https://mydomain.com/topic/subtopic1.
There will be an index page in the URL https://mydomain.com/topic/all that will show both https://mydomain.com/topic and https://mydomain.com/topic/subtopic1 as an index.
I’ve managed to do all three of them. But since the post in https://mydomain.com/topic is sitting as a page and not as a post, they aren’t coming up on the index page.
Is there something that I need to add in the index.hbs to say “also show this page”?
You’d use the template file guide.hbs to build your index page, including the summary of what the topic is about (this content would be static). Then you’d use posts to create each of the articles with a primary tag of guide.