Twig 101

You can nest blocks inside each other:

// my-template.twig
{% block test_block %}
    {% if myCondition %}
        {% block test_markup %}
            <a href="#">link</a>
        {% endblock %}
    {% endif %}
{% endblock %}

This way if you have a different condition in another template you can still reuse the outer block without repeating all the content:

// my-other-template.twig
{% block test_block %}
    {% if myNewCondition %}
        {{ block('test_markup', 'my-template.twig') }}
    {% endif %}
{% endblock %}