Reputation: 6107
When I use the following:
<html>
{% block head %}
<title>Hello</title>
{% endblock %}
The output in the HTML document is:
<html>
--- empty line ---
<title>Hello</title>
How can I avoid this empty line? I can use:
<html>
{% block head %}<title>Hello</title>
{% endblock %}
but that is ugly...
Thanks,
Joel
Upvotes: 3
Views: 3701
Reputation: 53998
If you are concerned about saving space/kbytes you can use the {% spaceless %}
template tag to get get rid of all the empty spaces between html tags. This is generally good practice. So put {% spaceless %}
at the very top of your base.html and {% endspaceless %}
at the very end
If you are worried about the asthetics of your code, there's not much you can do!
Upvotes: 5
Reputation: 16091
{% spaceless %}
?
https://docs.djangoproject.com/en/dev/ref/templates/builtins/#spaceless
Upvotes: 0