I have a block and I’m trying to wrap a link around it:
{% block paragraph %}
<div{{ attributes.addClass(classes) }}>
{% block content %}
<a href="{{ content.field_link.0['#url'] }}">
{{ content }}
</a>
{% endblock %}
</div>
{% endblock paragraph %}
But when the code is output, the link is above the block instead of around it, and it gets input into multiple other places inside the content. You can see everywhere there’s a /node/2, but nowhere is it doing anything useful (except for wrapping around the “Office” image, which comes from the {{ content }} and not from the wrapped link).
<div data-quickedit-entity-id="paragraph/5594" class="paragraph paragraph--transporter-item paragraph--view-mode-default" data-quickedit-entity-instance-id="0">
<a href="/node/2">
<!-- THEME HOOK: 'field' -->
<!-- BEGIN OUTPUT from 'modules/contrib/fences/field.html.twig' -->
</a>
<div class="paragraph--transporter-item__icon field field--name-field-icon field--type-entity-reference field--label-hidden field__items" data-quickedit-field-id="paragraph/5594/field_icon/en/default">
<a href="/node/2">
<!-- THEME HOOK: 'media' -->
<!-- BEGIN OUTPUT from 'core/modules/media/templates/media.html.twig' -->
</a>
<div data-quickedit-entity-id="media/9" class="contextual-region" data-quickedit-entity-instance-id="0">
<a href="/node/2">
<div data-contextual-id="media:media=9:changed=1561152189&langcode=en" data-contextual-token="8VIDU3VuOojWGK9hX_jn8ERolu-tvAZdOewrYfTFUwA" class="contextual" role="form">
<button class="trigger visually-hidden focusable" type="button" aria-pressed="false">Open configuration options</button>
<!-- THEME HOOK: 'links__contextual' -->
<!-- BEGIN OUTPUT from 'core/modules/system/templates/links.html.twig' -->
<ul class="contextual-links" hidden=""><li class="quickedit"><a href="" role="button" aria-pressed="false">Quick edit</a></li><li><a href="/media/9/edit?destination=/node/2">Edit</a></li><li><a href="/media/9/delete?destination=/node/2">Delete</a></li></ul>
<!-- END OUTPUT from 'core/modules/system/templates/links.html.twig' -->
</div>
<!-- THEME HOOK: 'field' -->
<!-- BEGIN OUTPUT from 'modules/contrib/fences/field.html.twig' -->
</a>
<div data-quickedit-field-id="media/9/field_media_image/en/default" class="field field--name-field-media-image field--type-image field--label-visually_hidden field__items quickedit-field">
<a href="/node/2">
<div class="field__label visually-hidden">Image</div>
</a>
<div class="field__item">
<a href="/node/2">
<!-- THEME HOOK: 'image_formatter' -->
<!-- BEGIN OUTPUT from 'core/modules/image/templates/image-formatter.html.twig' -->
</a>
<a href="http://arboreal.lndo.site/sites/default/files/2019-06/0010-office.svg">
<!-- THEME HOOK: 'image' -->
<!-- BEGIN OUTPUT from 'core/modules/system/templates/image.html.twig' -->
<img src="/sites/default/files/2019-06/0010-office.svg" alt="Office" typeof="foaf:Image" width="" height="">
<!-- END OUTPUT from 'core/modules/system/templates/image.html.twig' -->
</a>
<!-- END OUTPUT from 'core/modules/image/templates/image-formatter.html.twig' -->
</div>
</div>
<!-- END OUTPUT from 'modules/contrib/fences/field.html.twig' -->
</div>
<!-- END OUTPUT from 'core/modules/media/templates/media.html.twig' -->
</div>
<!-- END OUTPUT from 'modules/contrib/fences/field.html.twig' -->
<!-- THEME HOOK: 'field' -->
<!-- BEGIN OUTPUT from 'modules/contrib/fences/field.html.twig' -->
<div class=".paragraph--transporter-item__label field field--name-field-link field--type-link field--label-hidden field__items" data-quickedit-field-id="paragraph/5594/field_link/en/default">
<a href="/node/2">Office</a>
</div>
<!-- END OUTPUT from 'modules/contrib/fences/field.html.twig' -->
</div>
Why is this happening, and how do I get it so it just outputs the link in the one place and around the whole block?
<a>
or</a>
somewhere else on your page. What template exactly are you editing there?