[Fixed]-How to add anchor to django url in template

30👍

Make sure the actual anchor is defined like this in your template:

<a name="container"></a>

And then link to it the way you did:

<a data-hover="Are You At Risk?" href="{% url 'home' %}#container">My link</a>

If this does not work add / just before your #-tag:

<a data-hover="Are You At Risk?" href="{% url 'home' %}/#container">My link</a>

-1👍

past it between your anchor tag:

<a href="{% url 'your_url_name' object.parameter %}" class="pull-right" > Anchor Text{{object.parameter}}</a>
👤Rochan

Leave a comment