Organizing Ghost Posts in Tag Subdirectories
Organize your Ghost posts in subdirectories of their primary tags (ex. jesseweb.com/shell/create-an-array/)
Ghost is a great free and open source blogging platform. By default, Ghost serves all posts under the root domain (ex. jesseweb.com/some_post). Like storing all your computer files in a single folder, this can lead to all sorts of problems. Good news is that you can easily configure Ghost to serve posts under their primary tags (ex. jesseweb.com/some_tag/some_post).
- Under the Ghost admin section, go to
Settings | Labs
- Click
Download current routes.yaml
to download the current routes file - Edit the file and change the
collections
section to the exact contents below:
collections:
/:
permalink: /{primary_tag}/{slug}/
template: index
- Save the file
- Go back to
Settings | Labs
, clickUpload routes YAML
, and upload the file you just edited
✍️
For this to work, ensure all your posts are tagged with at least one tag (the first tag given to a post is its primary tag).
That's it! From now on, every post will be served under their primary tag.