Trouble with collections URL

Hi, I am trying to set up a collection for some courses. I have previously done this for other collections without any issues but for some reason it doesn’t want to work for my courses.

I am using Ghost v3 on a local install.

I have added a tag for example-course.

I have updated routes.yaml to include the collection path:

collections:
  /courses/example-course/:
    permalink: /courses/example-course/{slug}/
    template: examplecourse
    filter: primary_tag:example-course

I have also created the collection template.

{{!< default}}
{{#is "examplecourse"}}
    Content
{{/is}}

It will load up the page, but not the contents of the page.

I have tried stopping and starting the server but no luck.

EDIT:

I have noticed this problem occurs only when my routes.yaml is structured like this:

/courses/example-course/:
    permalink: /courses/example-course/{slug}/
    template: examplecourse
    filter: primary_tag:example-course

And not like this:

/example-course/:
    permalink: /courses/example-course/{slug}/
    template: examplecourse
    filter: primary_tag:example-course

The permalink works either way.

Is there any way around this, as I’d like /courses/ to be in the URL?

Managed to solve this by removing {{#is "examplecourse"}} {{/is}}

1 Like