Multiple Matrix blocks on one page I'm having a bit of difficulty having 2 different matrix blocks show on one page, and they both have Entries fields. As soon as I put {% set entry for my first Matrix, the second Matrix disappears.

{% for block in entry.sideMenu %}
 {% if block.type == "sideMenuItem" %}
    {% set entry = block.sideLink.first() %}
      {% if entry %}
         &lt;a href="{{ entry.url }}"&gt;{{ block.sideTitle }}&lt;/a&gt;
      {% endif %}
 {% endif %}
{% endfor %}
If you look at how Craft handles routing you will see this:


  If the URI matches an entry’s or category’s URI, the section’s/category group’s template will get loaded, and the matched element will be made available to the template via a pre-populated entry or category variable.


So Craft is assigning that entry variable that you are referencing on line 1 of your code. Then on line 3, you do {% set entry = block.sideLink.first() %} which overwrites that initial entry variable with this new value, which is why the second matrix disappears.

What you probably want to do is this:

{% for block in entry.sideMenu %}
  {% if block.type == "sideMenuItem" %}
    {% set sideLinkEntry = block.sideLink.first() %}
    {% if sideLinkEntry %}
       &lt;a href="{{ sideLinkEntry.url }}"&gt;{{ block.sideTitle }}&lt;/a&gt;
    {% endif %}
  {% endif %}
{% endfor %}


And your original entry will be unmodified.