Is there a way to remove /tag from url?

Version ghost:1.22.4

Hello,

Currently if you’d like to see all posts of a certain tag you’d have to go to myblog.com/tag/interesting-tag. Is there a way to remove the second slash and make the tag filter url structure look like: myblog.com/interesting-tag?

Thank you!

1 Like

A couple of solutions:

  1. Modify the routes.yaml so it looks like this:

    routes:

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

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

This would affect all tags and /tag/ urls may not work any more.

  1. Put something like this in the redirects.json:

    [{
    “from”: “^\/interesting-tag(\/?)$”,
    “to”: “/tag/interesting-tag/”
    }]

This will just redirect /interseting-tag to /tag/interesting-tag

https://docs.ghost.org/docs/dynamic-routing
https://docs.ghost.org/docs/redirects

1 Like

This is excellent. Thank you for the knowledge bomb!

You are welcome :slight_smile:

The docs say to add this to “content/settings/routes.yaml”

Where is this folder? Within the theme or ghost app itself?

If you go to “labs” in the sidebar there is an option to upload it directly at the bottom.

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