Add redirect to page 1 from bare URL
Previously, you could browse /board/ and /board/page/1/ in the browser and they would be the same thing. Now, /board/ redirects to /board/page/1/ to keep things unambiguous. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -66,19 +66,23 @@
|
||||
{# Page footer #}
|
||||
<div class="row pagination">
|
||||
{% if current_page > 1 %}
|
||||
<a href="/{{board.url}}/page/{{ current_page|add:"-1" }}">{% localize on %}Prev{% endlocalize %}</a>
|
||||
{% with prev_page=current_page|add:"-1" %}
|
||||
<a href="{% url 'board:board_detail' board.url prev_page %}">{% localize on %}Prev{% endlocalize %}</a>
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
[
|
||||
{% for page in pages %}
|
||||
{% if current_page == page %}
|
||||
<strong>{{page}}</strong>
|
||||
{% else %}
|
||||
<a href="page/{{page}}">{{page}}</a>
|
||||
<a href="{% url 'board:board_detail' board.url page %}">{{page}}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
]
|
||||
{% if current_page < last_page %}
|
||||
<a href="/{{board.url}}/page/{{ current_page|add:"1" }}">{% localize on %}Next{% endlocalize %}</a>
|
||||
{% with next_page=current_page|add:"1" %}
|
||||
<a href="{% url 'board:board_detail' board.url next_page %}">{% localize on %}Next{% endlocalize %}</a>
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user