Change the URL for tags and authors

Change the URL for tags and authors

Transform tags into topics, authors into contributors, or any into any other terms by updating your site's taxonomy.


A taxonomy classified things based on a common relation. Ghost uses two taxonomies to classify posts: authors and tags. The authors taxonomy groups posts by their author.

For example, Ghost automatically makes all posts by Jane Austen available at sitename.com/author/jane-austen/. Similarly, the tags taxonomy groups posts by their tag, and Ghost automatically makes all posts tagged with podcast available at sitename.com/tag/podcast/.

These taxonomies save you the trouble of creating archive pages for every author and tag, and, most of the time, they’re exactly what you need.

But what if you want to customize these taxonomies? What if, instead of post authors, you have post contributors? Instead of tags, you have topics?

In this tutorial, we’ll show you how to define custom taxonomies, transforming /author/ and /tag/ into new terms, with a few lines of code ⚡

Define your taxonomies in the routes.yaml file

Download your routes.yaml file from the SettingsLabs in Ghost Admin.

This file is split into three sections, and for this tutorial, you’ll be using the “taxonomies” section. Read more about dynamic routing for an overview of the rest of the file.

This is the default taxonomy configuration:

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

By changing the permalink structure – updating the values to the right of the colon –  you can customize the taxonomy to suit your publication’s needs:

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

Save this file and upload it to your Ghost site. Your new taxonomy is now live! For example, posts tagged with travel now show up at site.com/topic/travel/, rather than /tag/travel. Similarly, author pages now show up at site.com/contributor/author-slug/, rather than /author/author-slug.

Pretty neat, right?

Summary

You’ve successfully updated your taxonomies and permalinks for tags and authors on your Ghost publication 🥳

Be sure to share your sweet new taxonomies over on our Forum – our community is always excited to see how people are using Ghost.

On this page Introduction

How was the tutorial?

Be the first to know.

Join the Ghost developer community — sign up to get early access to the latest features, developer tools, and tutorials.

No spam. Once a month. Unsubscribe any time.