How to display a single category in PyroCMS

Yesterday, I was having some fun testing PyroCMS, when I stumbled upon something ‘annoying’ with the blog module. The blog module allows you to create categories (in a flat structure) but there’s no option to link to just a specific category.

Or so I thought, until I stumbled upon the documentation, that mentioned the URL structure for the blog module. Unlike Joomla! PyroCMS generates these URL’s regardless of whether you created a menu item or not. This allows you to easily link to a single category from within the menu.

The best part? You don’t need to code anything.

Here is how it’s done.

First off, you will need the ‘slug’ for your category.

  1. Go to Content > Blog
  2. You will see a list of categories. Click “Edit” next to the category you want to link to.
  3. In the next screen, take a note of (or copy) the info in the “Slug” box. You will need this later on.
Copy (or take a note of) the line in the "Slug" box
Copy the info in the “Slug” field
  1. Go to Structure > Navigation
  2. Click on “Add Link” to create a new Menu Item (You can do this in any of the available menu’s)
  3. For the new item, choose “Site Link” as the link type.
  4. In the site Link box, add the following: blog/<Your Category Slug>.  For example, if your category slug was news-and-updates, type “blog/news-and-updates” in this box.

PyroCMS Site Link

  1. Click Save
  2. Now, if you visit your front page you’ll see that you’ve got a menu item which is pointing to a single Category only, without having to change any code.

Discover more from PowerUser Guide

Subscribe now to keep reading and get access to the full archive.

Continue reading