Retrieving the URL in Django template language

Posted by Vernon on Stack Overflow See other posts from Stack Overflow or by Vernon
Published on 2010-06-16T16:09:07Z Indexed on 2010/06/17 21:03 UTC
Read the original article Hit count: 290

Filed under:
|

In a Django template, how could I refer to the URL. I want to use it in static pages, to avoid having live links to the current page. Is there a way to do this with the Django template language or do I have to use JavaScript to do it?

I would like to do something like

{% if current_url == "/about/" %}
About
{% else %}
<a href='/about/'>About</a>
{% endif %}

I'm using it for a simple blog, so there are no views written for those pages.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about django