Add a tag to slug and redirect to new pages in your ghost blog
If you’re looking to add a category tag slug to your permanent links in Ghost you can easily update the config files to allow this.
If you’re looking to add a category tag slug to your permanent links in Ghost you can easily update the config files to allow this.
If you’re looking to add a category tag slug to your permanent links in Ghost you can easily update the config files to allow this. Follow these initial steps to download the files:
If you want to have the primary tag as the tag in the permalink the first step is to update the routes.yaml file.
You can add the primary_tag
dynamic variable to the permalink setting as when below.
permalink: /{primary_tag}/{slug}/
After you have done this your URLs will have changed so to ensure Google updates correctly and provides a good user experience you need to set up 301 redirects as shown below. For each page, you will need to add one line and replace the ‘original-url’ with your original page URL and also update with the ‘newtag/new-url’ with your new URL.
Redirect rule:
^/original-url/$: /newtag/new-url/
Once you have updated these files you can upload them via eat e’labs’ section and your ghost blog will now have a new tag structure and 301 redirects to the new URLs.
Please check the sources below for additional information on the steps we took to get our blog to show tags and add successful redirects.
sources:
forum.ghost.org
forum.ghost.org