Answers.Body: <p>I'd say you want to look at the relations <a href="https://craftcms.com/docs/relations#the-relatedTo-param" rel="nofollow">https://craftcms.com/docs/relations#the-relatedTo-param</a></p>
  
  <p>You would then use <code>craft.entries.section( 'sectionHandle' ).relatedTo( category )</code> to grab all entries related to the category you are viewing.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-17T13:48:43.997Z
Answers.LastActivityDate: 2016-05-17T13:48:43.997Z
Answers.UserDisplayName: Luke Pearce
Body: <p>Just getting starting with templating so apologies if this is obvious. Couldn't find a solution through search.</p>
  
  <p>I have set up two sections. These contain different sets of information. </p>
  
  <p>I have one category group that lists UK counties like so..</p>
  
  <p>Country (Parent)
   - County (Child)
   - County (Child)
   - County (Child)</p>
  
  <p>Both sections have this category group as a category field. </p>
  
  <p>Now I want to create a Category page, but that only lists the entries for the section you are currently viewing. </p>
  
  <p>Lets say for example you are viewing a list of entries, or single entry in section 1.
  On an index page I'm displaying the category like so..</p>
  
  <p><code>{% for category in entry.county.level(2) %}&lt;a href="#"&gt;{{ category.title }}{% endfor %}</code></p>
  
  <p>and on a single page like so...</p>
  
  <p><code>{% set category = entry.county.last() %}
  &lt;a href="#"&gt;{{ category.title }}&lt;/a&gt;</code></p>
  
  <p>Now I want to link to the category page plate that will show a list of entries within that category.</p>
  
  <p>I have my category group set up like so...</p>
  
  <p><a href="https://i.sstatic.net/oQbG6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/oQbG6.png" alt="categorygroup"></a></p>
  
  <p>Now I'm not quite sure how to set this up so that it will only show the relevant sections entries.</p>
  
  <p>Does that make sense? </p>
  
  <p>Please ask if it's not clear and I can hopefully clarify!</p>
  
  <p>Thanks.</p>
  
Tags: <categories><category>
Title: Two sections sharing one category group
ThreadText: # Two sections sharing one category group
  
  (Asked by: username_0 on 2016-04-12)
  
  Just getting starting with templating so apologies if this is obvious. Couldn't find a solution through search.
  
  I have set up two sections. These contain different sets of information.
  
  I have one category group that lists UK counties like so..
  
  Country (Parent)
  - County (Child)
  - County (Child)
  - County (Child)
  
  Both sections have this category group as a category field.
  
  Now I want to create a Category page, but that only lists the entries for the section you are currently viewing.
  
  Lets say for example you are viewing a list of entries, or single entry in section 1.
  On an index page I'm displaying the category like so..
  
  `{% for category in entry.county.level(2) %}<a href="#">{{ category.title }}{% endfor %}`
  
  and on a single page like so...
  
  `{% set category = entry.county.last() %}
  <a href="#">{{ category.title }}</a>`
  
  Now I want to link to the category page plate that will show a list of entries within that category.
  
  I have my category group set up like so...
  
  [![categorygroup](https://i.sstatic.net/oQbG6.png)](https://i.sstatic.net/oQbG6.png)
  
  Now I'm not quite sure how to set this up so that it will only show the relevant sections entries.
  
  Does that make sense?
  
  Please ask if it's not clear and I can hopefully clarify!
  
  Thanks.
  
  **Tags:** categories, category
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-05-17. Score: 1
  
  I'd say you want to look at the relations <https://craftcms.com/docs/relations#the-relatedTo-param>
  
  You would then use `craft.entries.section( 'sectionHandle' ).relatedTo( category )` to grab all entries related to the category you are viewing.
  
  
  ---
  
  