Use for loop on index page instead of hardcoding post numbers

This commit is contained in:
Philipp Oppermann
2020-01-28 16:04:51 +01:00
parent 7d27a2c4a4
commit 78f55a701f
2 changed files with 15 additions and 20 deletions

View File

@@ -82,7 +82,7 @@ main img {
border: 2px solid #fc0
}
.posts.exceptions {
.posts.interrupts {
border: 2px solid #f66;
}
@@ -117,7 +117,7 @@ main img {
color: #990;
}
.post-category.exceptions {
.post-category.interrupts {
color: #f33;
}

View File

@@ -23,27 +23,22 @@
</p>
</div>
<div id="bare-bones" class="post-category bare-bones">Bare Bones</div>
<div class="posts bare-bones">
{{ macros::post_link(page=posts.0) }}
{{ macros::post_link(page=posts.1) }}
{{ macros::post_link(page=posts.2) }}
{{ macros::post_link(page=posts.3) }}
<div>
{% set chapter = "none" %}
{% for post in posts %}
{% if post.extra["chapter"] %}
{% if post.extra["chapter"] != chapter %}
{# Begin new chapter #}
{% set_global chapter = post.extra["chapter"] %}
</div>
<div id="exceptions" class="post-category exceptions">Exceptions</div>
<div class="posts exceptions">
{{ macros::post_link(page=posts.4) }}
{{ macros::post_link(page=posts.5) }}
{{ macros::post_link(page=posts.6) }}
</div>
<div id="{{chapter | slugify}}" class="post-category {{chapter | slugify}}">{{ chapter }}</div>
<div class="posts {{chapter | slugify}}">
{% endif %}
{% endif %}
<div id="memory-management" class="post-category memory-management">Memory Management</div>
<div class="posts memory-management">
{{ macros::post_link(page=posts.7) }}
{{ macros::post_link(page=posts.8) }}
{{ macros::post_link(page=posts.9) }}
{{ macros::post_link(page=posts.10) }}
{{ macros::post_link(page=post) }}
{% endfor %}
</div>
<div class="posts subscribe">