{% if value.caption %}
{% if page.listing_caption_label %}
{{ page.listing_caption_label }}
{% endif %}
{{ value.caption|markdown:page.pk|safe }}
{% endif %}
{% elif modal %}
{# Modals are always renedered on the main page because they are not working well in case of rendering inside sticky sidebar tabs #}
{% if page.listing_caption_label %}{{ page.listing_caption_label }}{% endif %}
{% include_block value.code %}
{% if value.caption %}
{{ value.caption|markdown:page.pk|safe }}
{% endif %}
{% else %}
{% include_block value.code %}
{% if value.caption %}
{% if page.listing_caption_label %}