In my website I have 5 categories: Animals, Kids, Fails, Sports and Dark (changing to Other). In order to link these categories to their own pages, I created a template group for categories. The index page in this group was the only template I required, and I copied the template for the home page, removing the featured slider as it was not needed because I only wanted to display the videos.

This was a relatively simple feature to include. There was literally no difference other than the slider between this page and the home page – they both used the videos channel to pull content from the database.

The difference on the page was simply that I included a {exp:channel:category_channel} tag pair around the title div, passing the title of the category into the <h2> tags. The real changes to set up this page came from the navigation embed template.

category nav

The key features of this are the {exp:channel:categories} tag pair, and the {path} tag. The videos channel is linked to the tag pair – I’ve set the style to linear, so that EE knows to use my format rather than list items for categories which is the default format.

Changing the a href link to {path=”categories/index”} means that whichever category was clicked on, EE will know to load the content specific to that category.

updated nav - categories

A simple change, a very small amount of code, and I now have 5 pages full of content specific to the page category. Awesome!

Advertisements