title: Question about jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'endfor'. Jinja was looking for the following tags: 'endblock'
body: <p>I am trying to build a website with Flask and I have been encountered a <code>jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'endfor'. Jinja was looking for the following tags: 'endblock'. The innermost block that needs to be closed is 'block'</code> error. When I try to log into my local webpage with localhost:5000 I get the above error.</p>
  <p>I have read through the traceback error and it seems to be occurring on line 21 of my index.html file.</p>
  <pre><code>
  {% block content %}
    &lt;h1&gt;Hi, {{ current_user.username }}!&lt;/h1&gt;
    {% if form %}
    &lt;form action=&quot;&quot; method=&quot;post&quot;&gt;
        {{ form.hidden_tag() }}
        &lt;p&gt;
            {{ form.post.label }}&lt;br&gt;
            {{ form.post(cols=32, rows=4) }}&lt;br&gt;
            {% for error in form.post.errors %}
            &lt;span style=&quot;color: red;&quot;&gt;[{{ error }}]&lt;/span&gt;
            {% endfor %}
        &lt;/p&gt;
        &lt;p&gt;{{ form.submit() }}&lt;/p&gt;
        &lt;/form&gt;
        {% endif %}
        { % for post in posts %}
              {% include '_post.html' %}
  
        {% endfor %}
        &lt;p&gt;
        {{ post.author.username }} says &lt;b&gt;{{ post.body }}&lt;/b&gt;
        &lt;/p&gt;
  
        
  {% endblock %}
  </code></pre>
  <p>The expected result is that I am able to log into my local Flask website and see other users posts on the webpage.</p>