Using the Ghost blog routes.yaml file it is possible to use the collections block to create a custom collection made from some tag(s) and / or other data. You can also tell this collection to use a custom theme template see:
For instance:
collections:
/example/:
permalink: /example/{slug}/
controller: channel
filter: tag:example-tag
template:
- example
All of the above works and my collection properly uses my new example
theme file.
The issue is that unlike the tag page (for example-tag
) my new custom collection does not have a readily documented way to work with the title etc.
It does not pull the title / meta description from the tag used to build the collection (which would be great for collections built from single tags). In an attempt to work around that I tried some {{#has}}
statements but I can’t figure out what context the custom route would fit into.
With the above example routes.yaml the title for the custom collection ends up as ‘My Site Name (Page 1)’ — and there is no Meta Description.
This issue also extends into the Open Graph data which lists an identical title as well as no description for the custom collection.
My guess is that it may be possible to use a data property attached to the routes.yaml file to achieve this (see: Ghost Themes - Dynamic URLs & Routing) but I haven’t found a solution as of now.
Here’s hoping someone has run into this as Googling around came up surprisingly empty — also posted over to StackOverflow for that reason: How do I set Ghost Blog Custom Routes.yaml Collection Title / Meta Description in my custom template? - Stack Overflow