<p>Argh! this code works! I had duplicate entries and looking at the wrong entry! User erroooor!</p>

CC BY-SA 4.0
2019-07-26T16:36:24.703Z
2019-07-26T16:36:24.703Z
Kev N
<p>I have a number of 'blog' channel entries related to various 'fayre' entries
I want to display all the blog entries related to the fayre entry page they are related to (Entry field is 'fayreBlog'), but not ones which are not related to that entry, so far I can only display only one blog entry and not more (even though there are more related to the entry I am relating to) not sure where my code is wrong? it resides in the fayres _entry.twig template:</p>

<pre><code>{% set relatedBlogs = craft.entries.section('blog').relatedTo(entry).all() %}

{% for post in relatedBlogs %}
    &lt;p&gt;{{ post.title }} &lt;/p&gt;
{% endfor %}
</code></pre>

<relatedto>
Display related entries on the entry page they are related to
# Display related entries on the entry page they are related to

(Asked by: username_0 on 2019-07-26)

I have a number of 'blog' channel entries related to various 'fayre' entries
I want to display all the blog entries related to the fayre entry page they are related to (Entry field is 'fayreBlog'), but not ones which are not related to that entry, so far I can only display only one blog entry and not more (even though there are more related to the entry I am relating to) not sure where my code is wrong? it resides in the fayres _entry.twig template:
{% set relatedBlogs = craft.entries.section('blog').relatedTo(entry).all() %}

{% for post in relatedBlogs %}
    {{ post.title }} 
{% endfor %}

**Tags:** relatedto

---

## 1 answers

### Answer by username_0 on 2019-07-26. Score: 1

Argh! this code works! I had duplicate entries and looking at the wrong entry! User erroooor!


---

