Invalid block tag on line 4: 'else'. Did you forget to register or load this tag?

I’m doing a basic web page, in my base.html file I have this code and when running the server and accessing the page, I
get this error. Here’s my code

<p>
  <a href="{% url 'learning_logs:index' %}">Learning Log</a>-
  <a href="{% url 'learning_logs:topics' %}">Topics</a>- {% if
  user.is_authenticated %} Hello, {{user.username}} {% else %}
  <a href="{% url 'accounts:login' %}">Log in</a>
  {% endif %}
</p>

{% block content %}{% endblock content %}

If this is an exact copy of your template, then you have a problem with your formatting.
Your if tag is split across lines - this causes problems with the template rendering engine.

thanks for your answer! Ia figured that it was the formatting extension in my editor. Already fixed it.