1

I'm building a simple blog that has the ability to publish entries:

  • Within a set of categories.
  • With no category set.

The URL format of a blog entry is /blog/YYYY/MM/DD/{slug}

Everything so far works, my section blog works and the templates/blog/index.html template loads correctly as does the templates/blog/_entry.html for blog entries.

Categories however don't seem to work as they seem to be conflicting with the entry URLs… I have a list of all blog categories at the top of the blog section with each section, eg: 'Recipes', linking to /blog/recipes (using the {category.url} var).

In Craft I have set the Blog categories settings set to:

  • Category URL Format: blog/{slug}
  • Nested Categories: not set/empty
  • Category Template: _category.html (I have also tried _category without the .html extension as the value with the same result)

The issue is that when I navigate to blog/recipes I get a 404 instead of the system serving the templates/blog/_category.html template I have set up.

Note: There are no custom routes setup for this site.

I'm not sure what I am doing wrong, single entries serve up fine, but I can't seem to get to the category listing of a blog's category.

Any help would be much appreciated.

3

I think the problem here could be to do with the path to your Category Template.

Make sure that in your category settings, the path to your Category Template file includes the folder it is nested within.

So instead of _category.html, you should put blog/_category.html (if that file is inside the Blog template folder)

There is also some docs on the Craft site that tells you how to template this file if you haven't seen it already.

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.