{% from "bootstrap/macros.html" import alert %} {% for message in get_flashed_messages() %} {# You can set messages_hide_close_button=True anywhere before including messages.html to not show close buttons. Or set it in a context processor. #} {{ alert(content=message, type=message.tags, close_button=not messages_hide_close_button) }} {% endfor %}