Reputation: 1
I have a Django template containing this menu:
<ul class="menu">
<li class="nav-current" role="presentation"><a href="">index</a></li>
<li role="presentation"><a href="/cpuinfo/">cpu info</a></li>
<li role="presentation"><a href="#">about</a></li>
</ul>
When I click "cpu info" from the home page my browser goes to /cpuinfo
. This works.
But when I am on other pages like /post/
that link takes me to /post/cpuinfo
, which isn't correct.
How can I make my link work from any page?
Upvotes: 0
Views: 37
Reputation:
You need url in template, for example:
<li role="presentation"><a href="{% url 'cpuinfo'%}">cpu info</a></li>
<!-- Change it ^^^ on real url name-->
Upvotes: 1