How can I specify a custom post template for a collection post


#1

I’m using latest ghost & cli (2.0.3 & 1.9.1) fresh local install, and using the new amazing dynamic routes somewhat successfully. I’ve managed to get the index page working just fine with a collection, but I’d like the pages within that collection to use a specific template, not the default post.hbs template. Now I know that I can define a custom-${templatename}.hbs template as was standard in 1.0, but I’d rather not have to require that editors have to select the custom layout from the admin side, rather I’d like to suggest a custom default based on the collection (& possible allow them to override). Is this functionality available or not yet?

For reference, here’s my routes.yml

routes:

  /:
    data: post.home
    template: home

collections:
  /showcase/:
    template: collection-showcase
    permalink: /showcase/{slug}/
    filter: tag:showcase

  /:
    permalink: /{slug}/
    template:
    - index
    filter: tag:-[showcase]

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/


#2

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.


#3

#4

I have exactly the same question. It is a shame this has never been answered. I must assume that the answer is no, you can’t have a custom post template for a collection. You can only have a custom index URL template for the collection. The tutorials really don’t make this clear at all.


#5

OK, I think the way forward is to create a global custom post template and select it when creating the post, as discussed here: