I have a website with a shop section with the following URL structure: homepage/shop/category/the-product.

I would like to add a page after the category to filter between post types within that category, and I want to be able to access it through the entry type slug in the URL.

I also need to change the template to match the Entry Type.

If this is possible, how do I do it?

Thanks ahead!


1 Answer 1


Certainly possible and simple too :)

First in the CP go to:


You'll want to set your Category URL formats and Category Template to reflect your URL scheme and desired location of your template file.

Then create an _entry template in the directory you specified above for example /categories/_entry.twig

When you head to the URL above your template will load with an entry variable that reflects whichever category you are browsing to.

In the _entry template to get all the entries related to the current category:

{% set entries = craft.entries.relatedTo( entry ) %}

(note this will default to 100 entries if you want more append .limit(101) etc. or .limit(null) to get them all.

and finally to load a layout based on the entry.type simply:

{% include ["_layouts/types/" ~ entry.type, "_layouts/types/default"] %}

where the default layout is for all entries that don't need any special layout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.