<p>You need to set the category variable.</p>

<p>In this example, I'm using a slug:</p>

<pre><code>{% set category = craft.categories.slug('catSlug') %}
</code></pre>

<p>So full code:</p>

<pre><code>{% set category = craft.categories.slug('catSlug') %}
{% set entries = craft.entries.relatedTo(category) %}
{% for entry in entries %}
    &lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;
{% endfor %}
</code></pre>

CC BY-SA 3.0
2016-07-07T21:41:36.367Z
Bravo...... you guys on here are so helpful. I really appreciate all the help..

One more, if I want to limit/offset the output.? 

Thanks Again..
fidel
CC BY-SA 3.0
2016-07-07T22:27:30.380Z
Found the second part out... 
Thanks again.
fidel
CC BY-SA 3.0
2016-07-08T01:32:55.000Z
I just started using Craft myself. So learning together is a good thing! Glad you got it figured out. Everything seems to work around the different content models. Once you get a grasp of that, it falls into place.
Erik
CC BY-SA 3.0
2016-07-07T21:24:22.957Z
2016-07-07T21:24:22.957Z
Erik
<p>Another easy question for you all.... 
I'm trying to display all entries in a specific category. I'm using the below code from the Craft site, but not sure what I'm missing. I'm replacing the "entries" in the output section with the category name.</p>

<pre><code>{% set entries = craft.entries.relatedTo(category) %}

{% for entry in entries %}
    &lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;
{% endfor %}
</code></pre>

<p>Thank you... </p>

<entries><category>
Category Entries
# Category Entries

(Asked by: username_0 on 2016-07-07)

Another easy question for you all.... 
I'm trying to display all entries in a specific category. I'm using the below code from the Craft site, but not sure what I'm missing. I'm replacing the "entries" in the output section with the category name.
{% set entries = craft.entries.relatedTo(category) %}

{% for entry in entries %}
    {{ entry.title }}
{% endfor %}

Thank you...

**Tags:** entries, category


---

## 1 answers

### Answer by username_1 on 2016-07-07. Score: 1

You need to set the category variable.
In this example, I'm using a slug:
{% set category = craft.categories.slug('catSlug') %}

So full code:
{% set category = craft.categories.slug('catSlug') %}
{% set entries = craft.entries.relatedTo(category) %}
{% for entry in entries %}
    {{ entry.title }}
{% endfor %}

> **Comments:**
> **username_0**: Bravo...... you guys on here are so helpful. I really appreciate all the help..  One more, if I want to limit/offset the output.?   Thanks Again..  
> **username_0**: Found the second part out...  Thanks again.  
> **username_1**: I just started using Craft myself. So learning together is a good thing! Glad you got it figured out. Everything seems to work around the different content models. Once you get a grasp of that, it falls into place.  

---

