<p>You can do this in a Single without too much trouble. Your homepage will presumably have its own template, so the simplest solution is to content-manage the fields for your Hero, Intro and Image Slider in the homepage Single, and then in the homepage template, hardcode the channels which will form the source of your main entry loop. That way, your homepage Single is responsible for managing content that is specific to that page only, and then outputs other content from elsewhere below.</p>

<p>Here's a quick example of how that might look in your homepage template Twig file:</p>

<pre><code>{% set myHeroField = entry.myHeroField %}
{% set myIntroField = entry.myHeroField %}
{% set sliderImages = entry.sliderImagesField %}

&lt;h2&gt;{{ myHeroField.heading&lt;/h2&gt;
&lt;p&gt;{{ myHeroField.strapline&lt;/p&gt;
&lt;a href="{{ myHeroField.ctaLink.one().url"&gt;Read more&lt;/a&gt;

&lt;p class="intro"&gt;{{ myIntroField.textContent }}&lt;/p&gt;
&lt;a href="{{ myIntroField.ctaLink.one().url }}"&gt;See more&lt;/a&gt;

&lt;div class="carousel"&gt;
{% for sliderImage in sliderImages.all() %}
    &lt;img src="{{ slideImage.one().url }}&gt;
{% endfor %}
&lt;/div&gt;

&lt;!-- MAIN ENTRY CONTENT HERE --&gt;
{% set myContentEntries = craft.entries.section('myContentSection').all() %}

{% for contentEntry in myContentEntries %}
    &lt;!-- Output blog posts etc. --&gt;
{% endfor %}
</code></pre>

<p>If you want to get more advanced and flexible, you could use a dropdown or similar in your homepage fields to define which Sections you want to be included in the main entry loop. Sadly, there isn't a first-party Section fieldtype, though there is a third-party plugin (now deprecated, unfortunately). Alternatively, depending on how complex and changeable your content model is, you could use a Dropdown fieldtype and just hardcode your section handles into the values.</p>

<p>In your homepage template, you'd then do something like this to fetch entries to show in the main entry content:</p>

<pre><code>{% set myContentEntries = craft.entries.section(entry.sectionsToShow).all() %} 
</code></pre>

CC BY-SA 4.0
2020-05-11T18:43:04.347Z
Only thing I'd change about this answer is you probably want to ``limit`` how many entries you want to retrieve (and thus show). Sounds trivial now but can help squash performance issues later.
RitterKnight
CC BY-SA 4.0
2020-05-11T16:02:14.013Z
2020-05-11T16:02:14.013Z
Martin Spain
<p><a href="https://craftcms.stackexchange.com/a/35327/1016">Martin Spain's answer</a> covers a tactical way to handle this, but I thought I'd tackle this a different way.</p>

<p>When you use the pre-built routing for entries or categories, Craft does some things behind the scenes to make things easier; for example, it sets the <code>entry</code> or <code>category</code> template variable for you.  </p>

<p>However, that can make it <em>seem</em> like you can only grab fields/content from the current entry.</p>

<p>One of the nice things about Craft is the templates you use to display content can really be "decoupled" from the routing. Any <strong>template</strong> can more or less bring in any <strong>piece of content</strong> from anywhere else in the system, you just need to know where to find/query it. </p>

<p>You do this with <a href="https://docs.craftcms.com/v3/dev/element-queries/" rel="nofollow noreferrer">Element Queries</a>.</p>

<p>However, this can cause some confusion if you're used to other systems. (The WordPress loop is a good/terrible example of this—to work around it, you can use WP_Query but it's not as clean and neat.)</p>

<p>The only differences between a Structure, Channel, and Single are the way the UI is presented to the author,  the way each piece of content gets routed, and how many pieces of content each section can hold (or to put it another way, how they're grouped together). The actual <em>content</em> is up to you for each section.</p>

CC BY-SA 4.0
2020-05-11T19:13:59.380Z
2020-05-11T19:13:59.380Z
RitterKnight
<p>I've been learning Craft 3 for a couple weeks and I've run into a little snag. I have a homepage that I would like to display multiple entry loops and/or types. However, I cannot find how to do this on a Single (section). Ive been experimenting around, and I can get the desired effect by making the homepage a Structure (section) via multiple entry types, but that gets janky with the URL/URi setup (I've seen other articles saying to use the <code>__home__</code> method, but seems like it gets messy to try and work around that with sub-pages).</p>

<p>Here is kinda what I'm going after for the homepage:</p>

<hr>

<p>Hero Element (has a few of it's own fields)</p>

<hr>

<hr>

<p>Intro Element (has a few of it's own fields)</p>

<hr>

<hr>

<p>Image Slider Element (loops through some image asset entries)</p>

<hr>

<hr>

<p>MAIN ENTRY LOOP (loops through some entries that you click to go to the full entry (which has its own template))</p>

<hr>

<p><strong>So in summary,</strong> 
How can I have multiple entry loops/types on a Single, <strong>OR</strong> Use a Structure section as the homepage without getting to janky with the URL/URi? <strong>OR</strong> is there a better way to set this up that I'm not thinking of?</p>

<craft3><structure><sections><singles>
How to display multiple entry loops on the homepage (Single section type)
# How to display multiple entry loops on the homepage (Single section type)

(Asked by: username_0 on 2020-05-11)

I've been learning Craft 3 for a couple weeks and I've run into a little snag. I have a homepage that I would like to display multiple entry loops and/or types. However, I cannot find how to do this on a Single (section). Ive been experimenting around, and I can get the desired effect by making the homepage a Structure (section) via multiple entry types, but that gets janky with the URL/URi setup (I've seen other articles saying to use the `__home__` method, but seems like it gets messy to try and work around that with sub-pages).

Here is kinda what I'm going after for the homepage:

---

Hero Element (has a few of it's own fields)

---

---

Intro Element (has a few of it's own fields)

---

---

Image Slider Element (loops through some image asset entries)

---

---

MAIN ENTRY LOOP (loops through some entries that you click to go to the full entry (which has its own template))

---

**So in summary,**
How can I have multiple entry loops/types on a Single, **OR** Use a Structure section as the homepage without getting to janky with the URL/URi? **OR** is there a better way to set this up that I'm not thinking of?

**Tags:** craft3, structure, sections, singles


---

## 2 answers

### Answer by username_1 on 2020-05-11. Score: 2 | Accepted answer

You can do this in a Single without too much trouble. Your homepage will presumably have its own template, so the simplest solution is to content-manage the fields for your Hero, Intro and Image Slider in the homepage Single, and then in the homepage template, hardcode the channels which will form the source of your main entry loop. That way, your homepage Single is responsible for managing content that is specific to that page only, and then outputs other content from elsewhere below.
Here's a quick example of how that might look in your homepage template Twig file:
{% set myHeroField = entry.myHeroField %}
{% set myIntroField = entry.myHeroField %}
{% set sliderImages = entry.sliderImagesField %}

{{ myHeroField.heading
{{ myHeroField.strapline
Read more

{{ myIntroField.textContent }}
See more


{% for sliderImage in sliderImages.all() %}
    <img src="{{ slideImage.one().url }}>
{% endfor %}



{% set myContentEntries = craft.entries.section('myContentSection').all() %}

{% for contentEntry in myContentEntries %}
    
{% endfor %}

If you want to get more advanced and flexible, you could use a dropdown or similar in your homepage fields to define which Sections you want to be included in the main entry loop. Sadly, there isn't a first-party Section fieldtype, though there is a third-party plugin (now deprecated, unfortunately). Alternatively, depending on how complex and changeable your content model is, you could use a Dropdown fieldtype and just hardcode your section handles into the values.
In your homepage template, you'd then do something like this to fetch entries to show in the main entry content:
{% set myContentEntries = craft.entries.section(entry.sectionsToShow).all() %}

> **Comments:**
> **username_2**: Only thing I'd change about this answer is you probably want to ``limit`` how many entries you want to retrieve (and thus show). Sounds trivial now but can help squash performance issues later.  

---

### Answer by username_2 on 2020-05-11. Score: 1

[username_1's answer](https://craftcms.stackexchange.com/a/35327/1016) covers a tactical way to handle this, but I thought I'd tackle this a different way.

When you use the pre-built routing for entries or categories, Craft does some things behind the scenes to make things easier; for example, it sets the `entry` or `category` template variable for you.

However, that can make it *seem* like you can only grab fields/content from the current entry.

One of the nice things about Craft is the templates you use to display content can really be "decoupled" from the routing. Any **template** can more or less bring in any **piece of content** from anywhere else in the system, you just need to know where to find/query it.

You do this with [Element Queries](https://docs.craftcms.com/v3/dev/element-queries/).

However, this can cause some confusion if you're used to other systems. (The WordPress loop is a good/terrible example of this—to work around it, you can use WP\_Query but it's not as clean and neat.)

The only differences between a Structure, Channel, and Single are the way the UI is presented to the author, the way each piece of content gets routed, and how many pieces of content each section can hold (or to put it another way, how they're grouped together). The actual *content* is up to you for each section.


---

