New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Archive navigation #2599
Merged
Merged
Archive navigation #2599
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e3f1e15
Add CREATE_ARCHIVE_NAVIGATION (#1639)
Kwpolska c88f4f8
Fix bugs and address some comments
Kwpolska bac9401
Add some support to templates
Kwpolska 0e8b8ce
Fix “issue” (not really) found by Codacy
Kwpolska a9b3f75
Use archive navigation in all 3 necessary templates
Kwpolska e83d413
Better theming for archive navigation
Kwpolska 372932b
Merge branch 'master' into archive-navigation
Kwpolska 8ee8349
Inserting navigation archive names.
felixfontein 5f1ff5c
Running scripts/jinjify.py.
felixfontein 0588b51
Improving name for top-level archive.
felixfontein File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
nikola/data/themes/base-jinja/templates/archive_navigation_helper.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{# -*- coding: utf-8 -*- #} | ||
|
||
{% macro archive_navigation() %} | ||
{% if 'archive_page' in pagekind %} | ||
{% if has_archive_navigation %} | ||
<nav class="archivenav"> | ||
<ul class="pager"> | ||
{% if previous_archive %} | ||
<li class="previous"><a href="{{ previous_archive }}" rel="prev">{{ messages("Previous") }}</a></li> | ||
{% else %} | ||
<li class="previous disabled"><a href="#" rel="prev">{{ messages("Previous") }}</a></li> | ||
{% endif %} | ||
{% if up_archive %} | ||
<li class="up"><a href="{{ up_archive }}" rel="up">{{ messages("Up") }}</a></li> | ||
{% else %} | ||
<li class="up disabled"><a href="#" rel="up">{{ messages("Up") }}</a></li> | ||
{% endif %} | ||
{% if next_archive %} | ||
<li class="next"><a href="{{ next_archive }}" rel="next">{{ messages("Next") }}</a></li> | ||
{% else %} | ||
<li class="next disabled"><a href="#" rel="next">{{ messages("Next") }}</a></li> | ||
{% endif %} | ||
</ul> | ||
</nav> | ||
{% endif %} | ||
{% endif %} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
{# -*- coding: utf-8 -*- #} | ||
{% extends 'index.tmpl' %} | ||
{% import 'archive_navigation_helper.tmpl' as archive_nav with context %} | ||
|
||
{% block extra_head %} | ||
{{ super() }} | ||
{% if translations|length > 1 and generate_atom %} | ||
{% for language in translations|sort %} | ||
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ archive_name }} section ({{ language }})" href="{{ _link("archive_atom", archive_name, language) }}"> | ||
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ archive_name }} archive ({{ language }})" href="{{ _link("archive_atom", archive_name, language) }}"> | ||
{% endfor %} | ||
{% elif generate_atom %} | ||
<link rel="alternate" type="application/atom+xml" title="Atom for the {{ archive_name }} archive" href="{{ _link("archive_atom", archive_name) }}"> | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block content_header %} | ||
{{ archive_nav.archive_navigation() }} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
nikola/data/themes/base/templates/archive_navigation_helper.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## -*- coding: utf-8 -*- | ||
|
||
<%def name="archive_navigation()"> | ||
%if 'archive_page' in pagekind: | ||
%if has_archive_navigation: | ||
<nav class="archivenav"> | ||
<ul class="pager"> | ||
%if previous_archive: | ||
<li class="previous"><a href="${previous_archive}" rel="prev">${messages("Previous")}</a></li> | ||
%else: | ||
<li class="previous disabled"><a href="#" rel="prev">${messages("Previous")}</a></li> | ||
% endif | ||
%if up_archive: | ||
<li class="up"><a href="${up_archive}" rel="up">${messages("Up")}</a></li> | ||
%else: | ||
<li class="up disabled"><a href="#" rel="up">${messages("Up")}</a></li> | ||
%endif | ||
%if next_archive: | ||
<li class="next"><a href="${next_archive}" rel="next">${messages("Next")}</a></li> | ||
%else: | ||
<li class="next disabled"><a href="#" rel="next">${messages("Next")}</a></li> | ||
%endif | ||
</ul> | ||
</nav> | ||
%endif | ||
% endif | ||
</%def> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
## -*- coding: utf-8 -*- | ||
<%inherit file="index.tmpl"/> | ||
<%namespace name="archive_nav" file="archive_navigation_helper.tmpl" import="*"/> | ||
|
||
<%block name="extra_head"> | ||
${parent.extra_head()} | ||
%if len(translations) > 1 and generate_atom: | ||
%for language in sorted(translations): | ||
<link rel="alternate" type="application/atom+xml" title="Atom for the ${archive_name} section (${language})" href="${_link("archive_atom", archive_name, language)}"> | ||
<link rel="alternate" type="application/atom+xml" title="Atom for the ${archive_name} archive (${language})" href="${_link("archive_atom", archive_name, language)}"> | ||
%endfor | ||
%elif generate_atom: | ||
<link rel="alternate" type="application/atom+xml" title="Atom for the ${archive_name} archive" href="${_link("archive_atom", archive_name)}"> | ||
%endif | ||
</%block> | ||
|
||
<%block name="content_header"> | ||
${archive_nav.archive_navigation()} | ||
</%block> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should also insert
nodelevel
into the context so that link texts (next year/month/day) can be chosen appropriately without unnecessary complicated code (like manually counting the number of slashes in the classification etc.).