Is there a way in which I can write a path of a div tag of one html file into another html file in django {% url 'file_name' %}

Viewed 38

This is line of code from my about_us.html page:

<a class="nav-link page-scroll" href="index.html#faq">FAQ</a>

How should I create a path for #faq from index.html into about_us.html in Django?

1 Answers

Using the template syntax you can link to an anchor of another page like this:

<a class="nav-link page-scroll" href="{% url 'index.html' %}#faq">FAQ</a>

One thing to pay attention to is the use of double quotes (") and single quotes (') in order to prevent having to use escape characters, PEP rules say to use it like I have shown here or with the single quotes on the outside and double quotes on the inside if you prefer.

Related