Q:

Django Invalid block tag: 'else', expected 'endblock'

OK so I'm still fairly new to django and working with it on a personal project. I am receiving this error for the following code:
{% extends "base.html" %}
{% block content %}
    <h1>Website News</h1>
    <% if news_items|length > 0 %>
        {% for post in news_items %}
            <h1>{{post.title}}</h1>
            {% autoescape off %}
                {{post.content}}
            {% endautoescape %}
        {% endfor %}
    {% else %}
        <h1>There are no posts currently</h1>
    {% endif %}
{% endblock %}

Apparently it doesn't like the {% else %} in my if statemtent. I have already done a decent amount of searching and found some somewhat similar issues but their issues all had to do with either improperly nested blocks or a wrong character. I've checked the docs a bunch and can't find anything wrong with my code besides django complaining. 
Any ideas?

A:

You have
<% if news_items|length > 0 %>

instead of:
{% if news_items|length > 0 %}

in your code, which is not a correct template tag.

