Can you dynamically create collections based on primary_tag?


#1

Hi,

Using Ghost 2.

Trying to work out how to dynamically create catalogs based on primary tags.

That is, rather than having to manually specify every catalog in routes.yaml, eg:

collections:
  /catalog1/:
    permalink: /catalog1/{slug}/
    filter: primary_tag:catalog1
  /catalog2/: 
    permalink: /catalog2/{slug}/
    filter: primary_tag:catalog2
  /catalog3/: 
    permalink: /catalog3/{slug}/
    filter: primary_tag:catalog3
.
.
. etc

Obviously this doesn’t work, but is it possible to do something like this:

collections:
  /{{primary_tag}}/: 
    permalink: /{{primary_tag}}/{slug}/
    filter: primary_tag:{{primary_tag}}

That way, as content creators generate and use new primary tags, these collections are automatically defined and made available; and no maintenance of routes.yaml necessary.

Just can’t get my head around it. All hints welcome!!!


closed #2

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