How to remove the /tag segment in the URL?

Greetings, i’m new in the Ghost and i noticed that the cms uses Tags to categorize posts. Cool but the annoying thing is that i want the tag (category) name to be directly referenced after the domain name.

For example:

https://example.com/sports

and not

https://example.com/tag/sports

Is this possible and if so will make things working strange?

Thanks in advance! :smiling_face:

Yes. Take a look at the routes.yaml documentation.

1 Like

Hi, thanks for the reply, if i remove the /tag and let only the slug, in an upcoming update i will have any issue?

I run a non-standard tag path (/topic/whatever instead of /tag/whatever) and that works fine. But I’ve never tried with something that matches potential page slugs.

I don’t have a crystal ball for future updates.

What I’d suggest you do to make sure that it’s good for the present is:

  1. Save an un-edited copy of routes.yaml, in case you realize you’ve broken something
  2. Right after you upload the edited routes.yaml, test that everything is behaving as you’d expect, including:
  • Check that your sitemap-tags.xml looks right.
  • Check that clicking a tag anywhere your theme displays tags is going to the tags page
  • Check your posts and pages and make sure none of them duplicate a tag’s slug. Fix one or the other if so.
1 Like