<p>Thanks to help from Ryan on the Discord group, I found an answer. This being…</p>
<pre class="lang-twig prettyprint-override"><code>// Call the channel
{% for serviceEntry in craft.entries.section('service').limit(3).all() %}
  &lt;h1&gt;{{ serviceEntry.title }}&lt;/h1&gt;
  &lt;p&gt;{{ serviceEntry.excerpt }}&lt;/p&gt;
  &lt;ul&gt;
    // Call the block within the loop
    {% for block in serviceEntry.serviceList %}
      {% if block.type == &quot;list&quot; %}
        &lt;li&gt;{{ block.item }}&lt;/li&gt;
      {% endif %}
    {% endfor %}
  &lt;/ul&gt;
  // Same as above
  {% for block in serviceEntry.internalButton %}
    {% if block.type == &quot;internalButton&quot; %}
      // Create varible for url
      {% set url = block.buttonDestination.first() %}
      &lt;a href=&quot;{{ url.getUrl }}&quot; title=&quot;{{ block.buttonDescription }}&quot; aria-label=&quot;Button Link&quot;&gt;{{ block.buttonText }}&lt;/a&gt;
    {% endif %}
  {% endfor %}
{% endfor %}
</code></pre>

CC BY-SA 4.0
2021-10-02T17:31:25.097Z
2021-10-18T10:13:24.707Z
2021-10-18T10:13:24.707Z
Grant Smith
<p>Very new to craft and hence sorry if this is very basic. I have created a service channel which contains some matrix fields. One for a list and one for button. My approach here may be wrong and hence please say if that is case. I appear to be in my service loop as the title and excerpt are outing, However, the matrix fields are not?</p>
<p>If I <code>{% dd serviceEntry %}</code> this shows <code>[serviceList] =&gt; null</code> which perhaps explains why the isn't outputting, but not why the fields are <code>null</code>?</p>
<pre><code>  &lt;div class=&quot;service card&quot;&gt;
    {% for serviceEntry in craft.entries.section('service').limit(3).all() %}
      &lt;h1&gt;{{ serviceEntry.title }}&lt;/h1&gt;
      &lt;p&gt;{{ serviceEntry.excerpt }}&lt;/p&gt;
      {% for block in entry.serviceList %}
      &lt;ul&gt;
      {% switch block.type %}
        {% case 'list' %}
        {% set item = block.item.one() %}
          &lt;li&gt;{{ block.item }}&lt;/li&gt;
      {% endswitch %}
      &lt;/ul&gt;
      {% endfor %}
      &lt;ul&gt;
      {% for block in entry.serviceList %}
        {% if block.type == &quot;list&quot; %}
        &lt;li&gt;{{ block.item }}&lt;/li&gt;
        {% endif %}
      {% endfor %}
      &lt;/ul&gt;
    {% endfor %}
  &lt;/div&gt;
</code></pre>
<p>Above are both the methods I have tried, neither of which work.</p>
<p>Handle: ServiceList<br />
Field Type: Matrix<br />
Block types: List<br />
Fields: Item</p>

<craft3><templating>
Output Matrix field within Channel
# Output Matrix field within Channel

(Asked by: username_0 on 2021-10-02)

Very new to craft and hence sorry if this is very basic. I have created a service channel which contains some matrix fields. One for a list and one for button. My approach here may be wrong and hence please say if that is case. I appear to be in my service loop as the title and excerpt are outing, However, the matrix fields are not?
If I {% dd serviceEntry %} this shows [serviceList] => null which perhaps explains why the isn't outputting, but not why the fields are null?
  
    {% for serviceEntry in craft.entries.section('service').limit(3).all() %}
      {{ serviceEntry.title }}
      {{ serviceEntry.excerpt }}
      {% for block in entry.serviceList %}
      
      {% switch block.type %}
        {% case 'list' %}
        {% set item = block.item.one() %}
          {{ block.item }}
      {% endswitch %}
      
      {% endfor %}
      
      {% for block in entry.serviceList %}
        {% if block.type == "list" %}
        {{ block.item }}
        {% endif %}
      {% endfor %}
      
    {% endfor %}
  

Above are both the methods I have tried, neither of which work.
Handle: ServiceList
Field Type: Matrix
Block types: List
Fields: Item

**Tags:** craft3, templating


---

## 1 answers

### Answer by username_0 on 2021-10-02. Score: 1

Thanks to help from Ryan on the Discord group, I found an answer. This being…
// Call the channel
{% for serviceEntry in craft.entries.section('service').limit(3).all() %}
  {{ serviceEntry.title }}
  {{ serviceEntry.excerpt }}
  
    // Call the block within the loop
    {% for block in serviceEntry.serviceList %}
      {% if block.type == "list" %}
        {{ block.item }}
      {% endif %}
    {% endfor %}
  
  // Same as above
  {% for block in serviceEntry.internalButton %}
    {% if block.type == "internalButton" %}
      // Create varible for url
      {% set url = block.buttonDestination.first() %}
      {{ block.buttonText }}
    {% endif %}
  {% endfor %}
{% endfor %}


---

