How do I include the category name in the URL and have that link work? I have a blog channel with a category called 'news'. I need the url to be - www.mysite/news/blog-post-heading. I currently am just shoving the category name in there and I need to know how to build up the link, because if you click on the link it goes to a error page because its trying to use the a template group name and I have no template group called news.


<h1><a href="/{categories}{category_name}{/categories}/{url_title}/">{title}</a></h1>

Do I make use of segments?

  • 2
    Presumably using this method you will have the same blog post served up under different URLs which in turn means you will end up with a duplicate content 'penalty'. Be sure to use the canonical URL meta tag. But more importantly won't this be confusing for visitors? Categories are for sorting and grouping rather than navigation.
    – foamcow
    May 23, 2014 at 9:34
  • Are you using EECMS 2.8?
    – Sobral
    May 23, 2014 at 12:05

2 Answers 2


Just checking I've understood your question correctly. Are you waiting to create a link to your blog page which includes the category AND the url title? So your final url would be www.mysite.com/blog/news/blog-post-heading as opposed to what you've stated above www.mysite.com/news/blog-post-heading.

As you've rightly pointed out, what you currently have won't work because EE is looking a news template.

If you could clarify what you're trying to achieve, please.

As a quick help, maybe Zoo Triggers (http://ee-zoo.com/add-ons/triggers/) or Low Search (http://gotolow.com/addons/low-search) could help you out?

  • Yes, I want it that way: www.mysite.com/blog/news/blog-post-heading
    – ObiWanKobi
    May 23, 2014 at 9:16
  • OK, you may be able to do something with segments and conditionals. Perhaps in your blog/index you could have {if segment_2 != "" AND segment_3 != ""} {embed="blog/post"} {if:else} // normal blog/index stuff here {/if} Then in blog/post you would alter your channel entries tag so that it targets segment_3. May 23, 2014 at 9:25
  • Oh, and simply change your link above to /blog/{categories}{category_name}{/categories}/{url_title}/ May 23, 2014 at 9:32
  • What about specifying it in the channel entries tag? Like: category_name="{segment_2}" url_title="{segment_3}"
    – ObiWanKobi
    May 23, 2014 at 10:05
  • I think because you are using the url_title in segment_3 that you won't need the category_name parameter. Really all it is allowing you to do is add keywords into your url (such as for better SEO). However you could probably use segment_2 in a separate query to display similar/related articles. May 23, 2014 at 10:13

Okay so perhaps I was being silly about how I do this and so I'm opting to make a news channel and just adding those posts there. @foamcow is right in sayin categories aren't for navigation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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