{% comment %}
  We want control over our error text, so we'll loop through them.

  Alternatively, you can use the default layout to generate a
  <ul> wrapped with <div class="errors">
    - {{ form.errors | default_errors }}
{% endcomment %}
{% if form.errors %}
  <div class="note form-error">
    <p>{{ 'general.forms.post_error' | t }}</p>

    <ul class="disc">
      {% for field in form.errors %}

        {% comment %}
          Check if it's a generic 'form' error and don't show the {{ field }}
        {% endcomment %}
        {% if field == 'form' %}
          <li>
            {{ form.errors.messages[field] }}
          </li>
        {% else %}
          <li>
            {% assign field_name = field | replace: 'body', 'message' %}
            {{ 'general.forms.post_field_error_html' | t: field: field_name, error: form.errors.messages[field] }}
          </li>
        {% endif %}

      {% endfor %}
     </ul>
  </div>
{% endif %}

{% comment %}
  We want control over our error text, so we'll loop through them.

  Alternatively, you can use the default layout to generate a
  <ul> wrapped with <div class="errors">
    - {{ form.errors | default_errors }}
{% endcomment %}
{% if form.errors %}
  <div class="note form-error">
    <p>{{ 'general.forms.post_error' | t }}</p>
    
    {% assign message = 'contact.form.message' | t %}
    
    <ul class="disc">
      {% for field in form.errors %}

        {% comment %}
          Check if it's a generic 'form' error and don't show the {{ field }}
        {% endcomment %}
        {% if field == 'form' %}
          <li>
            {{ form.errors.messages[field] }}
          </li>
        {% else %}
          
          <li>
            {% assign field_name = field | replace: 'body', message %}
            {{ 'general.forms.post_field_error_html' | t: field: field_name, error: form.errors.messages[field] }}
          </li>
        {% endif %}

      {% endfor %}
     </ul>
  </div>
{% endif %}
