Answers.Body: <p>Mystery solved; the relation code was too general; some of the entries were related to the category <em>on the homepage</em>, and the example code doesn't care about how or where the entries are related to the category as long as they are somewhere somehow.</p>
  
  <p>I needed to be more specific:</p>
  
  <pre><code>{% set thingsToDo = craft.entries.relatedTo({
      targetElement: category,
      field: 'typeOfThing'
  }) %}
  </code></pre>
  
  <p>Works.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-14T09:28:42.613Z
Answers.LastActivityDate: 2016-01-14T09:28:42.613Z
Answers.UserDisplayName: Matt Wilcox
Body: <p>Ok all - this is bound to be ridiculously simple, as it's one of the most basic things you can do (<a href="https://craftcms.com/support/entries-related-to-category" rel="nofollow">https://craftcms.com/support/entries-related-to-category</a>) - but I am ill and I can not figure out what I've done wrong.</p>
  
  <p>I have a category group 'Things To Do'. That group is set to allow categories in it to have their own URLs. The URL format is: things-to-do/{slug} and it uses the template 'things-to-do/category'.</p>
  
  <p>I also have a channel Things To Do, the URL format being 'things-to-do/{slug}' and using a different template 'things-to-do'.</p>
  
  <p>If I go to the url for a category that exists, it loads the correct template and I can output the correct fields attached to the category itself; e.g., {{ category.title }} or {{ category.myCustomField }}</p>
  
  <p>However, trying to output entries related to the category I'm viewing is instead just listing all entries regardless of their lack of association with the category...</p>
  
  <pre><code>{% set thingsToDo = craft.entries.relatedTo(category) %}
  {% for thingToDo in thingsToDo %}
      ...
  {% endfor %}
  </code></pre>
  
  <p>This should only be listing one entry for a given category, but it's listing all entries.</p>
  
  <p>What have a screwed up?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-01-13T17:56:36.340Z
Comments.Text: Does it help if you're explicit about which section the entries should be from?
Comments.UserDisplayName: Jamie Pittock
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-01-14T09:03:45.543Z
Comments.Text: Nope, makes no difference, and the entries are in the same section anyway. This seems really odd.
Comments.UserDisplayName: Matt Wilcox
Tags: <categories>
Title: Category archive page isn't filtering by current category
ThreadText: # Category archive page isn't filtering by current category
  
  (Asked by: username_0 on 2016-01-13)
  
  Ok all - this is bound to be ridiculously simple, as it's one of the most basic things you can do (<https://craftcms.com/support/entries-related-to-category>) - but I am ill and I can not figure out what I've done wrong.
  
  I have a category group 'Things To Do'. That group is set to allow categories in it to have their own URLs. The URL format is: things-to-do/{slug} and it uses the template 'things-to-do/category'.
  
  I also have a channel Things To Do, the URL format being 'things-to-do/{slug}' and using a different template 'things-to-do'.
  
  If I go to the url for a category that exists, it loads the correct template and I can output the correct fields attached to the category itself; e.g., {{ category.title }} or {{ category.myCustomField }}
  
  However, trying to output entries related to the category I'm viewing is instead just listing all entries regardless of their lack of association with the category...
  
  ```
  {% set thingsToDo = craft.entries.relatedTo(category) %}
  {% for thingToDo in thingsToDo %}
      ...
  {% endfor %}
  
  ```
  
  This should only be listing one entry for a given category, but it's listing all entries.
  
  What have a screwed up?
  
  **Tags:** categories
  
  > **Comments:**
  > **username_1**: Does it help if you're explicit about which section the entries should be from?  
  > **username_0**: Nope, makes no difference, and the entries are in the same section anyway. This seems really odd.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-01-14. Score: 2
  
  Mystery solved; the relation code was too general; some of the entries were related to the category *on the homepage*, and the example code doesn't care about how or where the entries are related to the category as long as they are somewhere somehow.
  
  I needed to be more specific:
  
  ```
  {% set thingsToDo = craft.entries.relatedTo({
      targetElement: category,
      field: 'typeOfThing'
  }) %}
  
  ```
  
  Works.
  
  
  ---
  
  