Hi everyone,
I’m trying to set up custom dynamic routing on my Ghost website, but I’m running into some issues. I want to create a custom route for a specific post collection and apply a different template to it. Here’s what I’ve done so far:
- Updated the
routes.yaml
file with the following configuration:
routes:
/custom-path/:
template: custom-template
collections:
/blog/:
permalink: /blog/{slug}/
template: blog
filter: tag:-custom
/custom-collection/:
permalink: /custom/{slug}/
template: custom-template
filter: tag:custom
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
- Restarted Ghost and verified that the
routes.yaml
file is valid.
The problems I’m facing:
- The
/custom-path/
route displays a 404 error even though I have posts with the requiredtag:custom
. - Posts that should belong to the
/custom-collection/
are still appearing in the/blog/
collection. - The custom template isn’t being applied to any posts under the custom collection.
What I’ve tried so far:
- Clearing the cache and restarting Ghost multiple times.
- Verifying that the
custom-template.hbs
file exists in the theme folder. - Ensuring the posts have the correct tag assigned.
I’d appreciate any advice on:
- Troubleshooting dynamic routing issues in Ghost.
- Debugging why the custom route is not being recognized.
- Whether my
routes.yaml
setup has any mistakes or missing configurations.
Thanks in advance for your help!