Custom routing for all tags page

Hello! I wanted to create a page where the user can see all existing tags in my site. So I read the following docs Ghost Themes - Dynamic URLs & Routing .
Hovewer, in my case the things not worked. Im using ghost 5.98.1 btw. Also, I’m working with a custom theme that is based on Attila.

Details:

I rewrote my route.yml as follows:

routes:

/tags/:
    permalink: /tags/
    template: all-tags

collections:
  /:
    permalink: /{slug}/
    template: index

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

I’m getting 404, when I navigate to /tags/.

My all-tags.hbs:

{{!< default}}

{{#get "tags" limit="all"}}
    <ul class="tags">
        {{#foreach tags}}
            <li>
                <a href="{{url}}">{{name}}</a>
            </li>
        {{/foreach}}
    </ul>
{{/get}}

What I tried and made difference:

route.yml:

routes:

collections:
  /:
    permalink: /{slug}/
    template: index
  /tags/:
    permalink: /tags/
    template: all-tags

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

However the layout was broken, the output completely overlapped the navigation section and in the browser my site name was the following: My site (Page 1). I don’t know what’s the reason behind it.

I would appreciate any help.

There is no indention before /tags/, and this cause the 404 error. The tag route doesn’t need permalink setting.

Here is the updated version:

routes:
  /tags/:
    template: all-tags

collections:
  /:
    permalink: /{slug}/
    template: index

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

Thank you, it works this way. I also figured out that the layout break was caused by my not proper template and it is also fixed.