I have implemented an error message alert bar on my website. However, I am facing an issue where the alert bar remains visible even when there are no messages to display. Can anyone provide guidance on how to make this alert bar appear only when there is a message?
Below is the code for my alert system:
<div class="alert alert-success">
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul>
{% for message in messages %}
<li>{{ message }} </li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
{% block content %}{% endblock %}
</div>