From bba3c52ff3a1047848e3c25165ad7b4c4c8a8eac Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 5 Oct 2017 11:25:10 +0200 Subject: [PATCH] Reverse posts array for increasing post numbers This should make it much easier to add a new post at the end. --- blog/templates/index.html | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/blog/templates/index.html b/blog/templates/index.html index b4adb514..aed91832 100644 --- a/blog/templates/index.html +++ b/blog/templates/index.html @@ -5,7 +5,8 @@ {% block title %}{{ config.title }}{% endblock title %} {% block main %} -{% set posts = get_section(path = "posts/_index.md") %} +{% set posts_section = get_section(path = "posts/_index.md") %} +{% set posts = posts_section.pages | reverse %}

This blog series creates a small operating system in the @@ -14,31 +15,31 @@ Github repository.

Latest post: - {% set latest_post = posts.pages|reverse|last %} + {% set latest_post = posts|last %} {{ latest_post.title }}

Bare Bones
- {{ macros::post_link(page=posts.pages.9) }} - {{ macros::post_link(page=posts.pages.8) }} - {{ macros::post_link(page=posts.pages.7) }} - {{ macros::post_link(page=posts.pages.6) }} + {{ macros::post_link(page=posts.0) }} + {{ macros::post_link(page=posts.1) }} + {{ macros::post_link(page=posts.2) }} + {{ macros::post_link(page=posts.3) }}
Memory Management
- {{ macros::post_link(page=posts.pages.5) }} - {{ macros::post_link(page=posts.pages.4) }} - {{ macros::post_link(page=posts.pages.3) }} - {{ macros::post_link(page=posts.pages.2) }} + {{ macros::post_link(page=posts.4) }} + {{ macros::post_link(page=posts.5) }} + {{ macros::post_link(page=posts.6) }} + {{ macros::post_link(page=posts.7) }}
Exceptions
- {{ macros::post_link(page=posts.pages.1) }} - {{ macros::post_link(page=posts.pages.0) }} + {{ macros::post_link(page=posts.8) }} + {{ macros::post_link(page=posts.9) }}