How to filter pages by tag in routes

I have the following pages: (this is a page not a post) has a tag named hash-a has a tag named hash-a has a tag named hash-b
how to access all pages with hash-b tag, it will return 404
I don’t know how to write routes.yaml?. Someone please help me Thanks

Check out our docs on routing. They contain the information you need to get this done: Ghost Themes - Dynamic URLs & Routing

We also have a tutorial on setting up custom collections, which discusses the basic concepts for accomplishing what you asked:

If you have additional questions – just ask :smiley:

1 Like

I did that, I filtered the posts, here are the contents of my routes file:

permalink: /{slug}/
template: index
filter: tag:hash-a
tag: /tag/{slug}/
author: /author/{slug}/

But the page is not working. I want the page with the hash-b tag to return 404. I want to emphasize the page not the post. Can you help me? Thank you

I’m not exactly sure I understand what you’re doing, but pages behave differently in collections. You might need to reach for the get helper to define a custom group of pages.