<aclass="nav-link {% if request.path.endswith('/posts') %}active"href="{{request.path}}"{%else%}"href="{{request.path.replace('/comments','/posts')}}"{%endif%}>
Posts
</a>
</li>
<liclass="nav-item">
<aclass="nav-link {% if request.path.endswith('/comments') %}active"href="{{request.path}}"{%else%}"href="{{request.path.replace('/posts','/comments')}}"{%endif%}>