diff options
-rwxr-xr-x | scripts/build.py | 9 | ||||
-rw-r--r-- | templates/entry.html | 6 |
2 files changed, 5 insertions, 10 deletions
diff --git a/scripts/build.py b/scripts/build.py index 03b83b3..2b6055d 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -81,13 +81,8 @@ if __name__ == '__main__': build_entry(jenv, entry) for index, entry in enumerate(published): - older = None - newer = None - if index > 0: - older = published[index-1] - if index < len(published) - 1: - newer = published[index+1] - + older = published[index:index-1] + newer = published[index:index+1] build_entry(jenv, entry, older, newer) if len(published) > 1: diff --git a/templates/entry.html b/templates/entry.html index f5f11c7..730e48d 100644 --- a/templates/entry.html +++ b/templates/entry.html @@ -12,11 +12,11 @@ </article> <div id="post-nav"> {% if older and newer%} - <a href="{{ older['file'] }}.html">Older ({{ older['title'] }})</a> — <a href="{{ newer['file'] }}.html">Newer ({{ newer['title'] }})</a> + <a href="{{ older[0]['file'] }}.html">Older ({{ older[0]['title'] }})</a> — <a href="{{ newer[0]['file'] }}.html">Newer ({{ newer[0]['title'] }})</a> {% elif older %} - <a href="{{ older['file'] }}.html">Older ({{ older['title'] }})</a> + <a href="{{ older[0]['file'] }}.html">Older ({{ older[0]['title'] }})</a> {% elif newer %} - <a href="{{ newer['file'] }}.html">Newer ({{ newer['title'] }})</a> + <a href="{{ newer[0]['file'] }}.html">Newer ({{ newer[0]['title'] }})</a> {% endif %} </div> {% endblock %} |