Answer the question
In order to leave comments, you need to log in
What's the best way to "catch" the current link for further visual highlighting?
Good evening.
My solution is based on catching the current slug in the view and further passing it to the template, where I iterate through the for loop.
How would you implement a method to "catch" the current page in order to extract a link to it?
# View
current_page = request.resolver_match.kwargs['slug']
context = {
'posts': posts,
'current_page': current_page
}
# Template
{% for tag in tags %}
<li class="nav-item rounded mr-3 mt-3">
<a class="nav-link link-dark {% if current_page == tag.slug %}active{% endif %}" href="{{ tag.get_absolute_url }}">{{ tag.title }}</a>
</li>
{% endfor %}
Answer the question
In order to leave comments, you need to log in
It is unlikely that the Asset Pipeline will pick up the fotns directory by itself
Add the fonts directory to public
So you are not specifying the path correctly! try doing this for everyone:
src: url("../fonts/bootstrap/glyphicons-halflings-regular.eot");
The font is not required at all. Now it is enough to include the css file.
<link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
<i class="fa fa-bomb fa-5x"></i>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question