{% spaceless %} Tag

removes irrelevant whitespace between HTML tags.

Coding As Markdown

Closing tag
Required — {% endspaceless %}

Documentation

Removes irrelevant whitespace between HTML tags.

Template

{% spaceless %}
<p>
  <small class="text-muted">
    Created on: {{ joke.created }}
    Last updated: {{ joke.updated }}
  </small>
</p>
{% endspaceless %}

Result

<p><small class="text-muted">
    Created on:
    Last updated:
  </small></p>

Notice that the whitespace within the small element has not been removed. Only whitespace between successive opening tags and successive closing tags is removed.

More Coding Tags

All Coding Tags


Did we get something wrong? Is there a use case for the spaceless tag that we should add? Please let us know.

Send Feedback

Official Documentation
This page last updated on August 2, 2026