Hi,
I’ve followed a tutorial at this page - http://www.train-ee.com/courseware/free-tutorials/comments/working-with-categories
I have the below code in place:
{exp:channel:categories channel="articles"}
<a href="http://{path=how-to-guides/index}">{category_name}</a>
{/exp:channel:categories}
When you click a category e.g. Email or Web Hosting you should be taken to that category page and the page should display the entries. e.g. Email page would show Outlook, macmail etc
However when I click the category link the URL looks correct /how-to-guides/category/email-panel but the page shows all categories and it’s entries.
How can I get the link to only show the entries for that particular category?
New to EE so not sure what I’m missing?
Hi Jason,
What does the /how-to-guides/index template look like? Could you include the code here? Make sure you don’t have dynamic=”no” as a parameter in the channel entries tag (https://docs.expressionengine.com/latest/channel/channel_entries.html#dynamic).
You should also check your category trigger word to make sure EE is looking for “category” in the URL to trigger the dynamic response for the appropriate categories. In EE3 that setting is under the “URL and Path Settings” and is called “Category URL Segment”.
If that is set to “category” and you have a channel entries tag on the /how-to-guides/index template that does not contain the dynamic=”no” parameter the channel entries should be automatically filtered by the category url title that appears in the 3rd URL segment in your example.
Hey,
Thanks for replying.
I’m using EEv2, I have checked the ‘category trigger word’ and it’s set to category. I don’t have dynamic=”no” entered in the code.
I’m probably going about this all wrong but at the moment I’m just trying to get the categories to show their listings. So I have a template default/test2, in that template I have only the below code:
{exp:channel:categories channel="articles"}
<a href="http://{path=how-to-guides/index}">{category_name}</a>
{/exp:channel:categories}
When I view the template in my browser, it shows all the categories as links, which is good but clicking any links e.g. Web hosting, results in a page showing the same-thing, a list of clickable categories.
The url changes to domainname.com/how-to-guides/category/web-hosting
I know this is probably simple to do but I’m stumped….
Hi Jason,
It sounds like the missing piece is that you have links that are pointing to /how-to-guide, but you don’t have a template at how-to-guide/index, so it doesn’t know what it should show for that URL.
Create an index template in the how-to-guides template group, and on that template, add a standard channel entries tags like so:
{exp:channel:entries channel="articles"}
{title}<br>
{/exp:channel:entries
Then, when you click on the links that are generated by the exp:channel:categories tag on the default/test2 template it will go the how-to-guides/index template and display the titles of the channel entries, filtered by the category url title that is being added to that link automatically by the channel categories tag. Once you have it showing you the correct channel entries you can modify the code on the how-to-guide/index template to display those entries however you choose.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.