Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

12
  • If i do that, i get the following error: Variable "entry" does not exist. It highlights that very first line as where the error happens. The site homepage doesn't throw that error, it only happens when i am in a category page like sitename.com/categoryname Commented Feb 16, 2015 at 16:43
  • @DanOwen Ahh sorry, I made the code to only work for entry pages (single, channel or structure entries with a categories field). Will try to change this... Commented Feb 16, 2015 at 16:54
  • @DanOwen I'm actually not sure if a category page automatically comes with a Category Model pre-assigned to the var category. If it does, the updated code could work ;) Commented Feb 16, 2015 at 17:03
  • 1
    @carlcs It does. I was wondering the same and just checked. Commented Feb 16, 2015 at 17:20
  • @carlcs Sounds good! BUT! It still throws that error for me on category list pages (it flag up the very first {% if entry %} as the error). That is, if a user clicks a category name, it lists all of the entries in that category (so im not in a page with a category field) Commented Feb 16, 2015 at 17:54