how to add anchor to django url in template

后端 未结 2 1768
遇见更好的自我
遇见更好的自我 2020-12-31 04:16

I am trying to add an anchor to my url in a django template like this:

My link         


        
相关标签:
2条回答
  • 2020-12-31 04:40

    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>
    
    0 讨论(0)
  • 2020-12-31 04:49

    past it between your anchor tag:

    <a href="{% url 'your_url_name' object.parameter %}" class="pull-right" > Anchor Text{{object.parameter}}</a>
    
    0 讨论(0)
提交回复
热议问题