Accessing custom block fields from a template file I have a sidebar region "Sidebar Ad" and placed in that region is the custom block "Sidebar Ad" of type "Image" which has two fields "Image" and "Link".

When I output the block on my page using {{ page.sidebar_ad }}, I get the image and the link separate from each other, which is to be expected. What I can't figure out, and I've been trying for around 5 hours now, is how to reference the fields separately so I can wrap the link around the image.

Does anyone know how to reference those fields? Am I going about this the wrong way?

I've successfully pulled the link URL by overriding the specific block template and referencing:

{% block content %}
        &lt;a href="{{ content.field_link.0['#url'].uri }}"&gt;&lt;/a&gt;
{% endblock %}


Referencing the image URL still eludes me.
This was the final solution.

{% block content %}
    &lt;a href="{{ content.field_link.0['#url'].uri }}"&gt;
        &lt;img src="{{ file_url(content.field_image.0['#item'].entity.fileuri) }}" alt="{{ content.field_image.0['#item'].alt }}"&gt;
    &lt;/a&gt;
{% endblock %}