Getting blocks from matrix and injecting them throughout a page, NOT a single loop statement I have a matrix field that allows the user to add little 'designed' features throughout the page.
These are placed in certain positions on the page and so I want to loop through these but because they are dotted about he page,  I cannot do a simple, for loop.
Instead I could get all the blocks like this:
  {% set nuggets = entry.nuggets
    .with([
    'nugget:nuggetBody',
    'nugget:icon'
  ])
    .all() %}

Then I could place them like so:
{% set nugget = nuggets[0] %}
{% include '_includes/_components/nugget.twig' with {
  self: {
    size:'xl',
    bgColor: nugget.circleColour.color[0].class,
    iconPath:nugget.icon[0].path,
    body: nugget.nuggetBody[0].bodyPlain
  }
} %}


{% set nugget = nuggets[1] %}
{% include '_includes/_components/nugget.twig' with {
  self: {
    size:'xl',
    bgColor: nugget.circleColour.color[0].class,
    iconPath:nugget.icon[0].path,
    body: nugget.nuggetBody[0].bodyPlain
  }
} %}

etc etc

I wondered if there is a better or more streamlined way than this?
And what happens if they don't have 'enough' blocks, how to accomodate, if for example, I have placed 6 around the page in the design and code, but they only add 4.  I know I could do this...
{% if nuggets|length &gt;= 3 %}
  {% set nugget = nuggets[2] %}
  {% include '_includes/_components/nugget.twig' with {
    self: {
      size:'xl',
      bgColor: nugget.circleColour.color[0].class,
      iconPath:nugget.icon[0].path,
      body: nugget.nuggetBody[0].bodyPlain
    }
  } %}
{% endif %}
etc

But is there a better approach...?
I would use a macro to output the contents of a single nugget (matrix block), this way you don't have to repeat the include statement multiple times. The only thing you need to keep track of is the current index, i.e. which item is next. You can't do this inside the macro, since a macro can't have persistent state. You have two options:

Set up a variable to keep track of the current index and increment it every time you include the macro.
Since you have six predefined positions where nuggets may be displayed, you can just hardcode the index and output the item at that index, if it exists.

Macro definition
{% macro nugget(nugget = null) %}
    {% if nugget %}
        {% include '_includes/_components/nugget.twig' with {
            self: {
                size: 'xl',
                bgColor: nugget.circleColour.color[0].class,
                iconPath: nugget.icon[0].path,
                body: nugget.nuggetBody[0].bodyPlain
            }
        } %}
    {% endif %}
{% endmacro %}

{% import _self as macros %}

Having the if-condition inside the macro to handle missing nuggets means you don't have to repeat that if-condition everywhere you want to include a nugget.
Option 1: Index variable
{% set nuggets = entry.nuggets
    .with([
        'nugget:nuggetBody',
        'nugget:icon'
    ])
    .all() %}
{% set nuget_index = 0 %}

{# Nugget position #1 #}
{% include macros.nugget(nuggets[nugget_index] ?? null) %}
{% set nugget_index = nugget_index + 1 %}

{# Nugget position #2 #}
{% include macros.nugget(nuggets[nugget_index] ?? null) %}
{% set nugget_index = nugget_index + 1 %}

{# Nugget position #3 #}
{% include macros.nugget(nuggets[nugget_index] ?? null) %}
{% set nugget_index = nugget_index + 1 %}

Option 2: Hardcoded nugget indexes
{# Nugget position #1 #}
{% include macros.nugget(nuggets[0] ?? null) %}

{# Nugget position #2 #}
{% include macros.nugget(nuggets[1] ?? null) %}

{# Nugget position #3 #}
{% include macros.nugget(nuggets[2] ?? null) %}