summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2016-11-15 13:50:20 +0100
committerJohannes Löthberg <johannes@kyriasis.com>2016-11-15 13:50:20 +0100
commit46bad35efce8817fd9fae0450e416f820ff742ce (patch)
tree9fa4cc4e460c34ce358acab323d4860b6cdf401e
parent294fd044deff8e727a29847712a25149c1545063 (diff)
downloadkyblo-46bad35efce8817fd9fae0450e416f820ff742ce.tar.xz
Simplify older/newer logic
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
-rwxr-xr-xscripts/build.py9
-rw-r--r--templates/entry.html6
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 %}