Display posts of chapter as list

This commit is contained in:
Philipp Oppermann
2020-12-28 19:48:47 +01:00
parent 7cc3d5e3b9
commit 5c3015acc3
2 changed files with 21 additions and 16 deletions

View File

@@ -555,6 +555,10 @@ main img {
margin-right: -0.5rem; margin-right: -0.5rem;
} }
.posts ul {
padding-left: 2em;
}
.posts.neutral { .posts.neutral {
border: 2px solid #999; border: 2px solid #999;
} }

View File

@@ -18,7 +18,7 @@
needed code, so you can follow along if you like. The source code is also available in the corresponding needed code, so you can follow along if you like. The source code is also available in the corresponding
<a href="https://github.com/phil-opp/blog_os">Github repository</a>. <a href="https://github.com/phil-opp/blog_os">Github repository</a>.
</p> </p>
<p>Latest post: <p>Latest post:
{% set latest_post = posts|last %} {% set latest_post = posts|last %}
<strong><a href="{{ latest_post.path | safe }}">{{ latest_post.title }}</a></strong> <strong><a href="{{ latest_post.path | safe }}">{{ latest_post.title }}</a></strong>
@@ -29,27 +29,28 @@
<p>In the following posts, we explain how to create an operating system for the <code>x86_64</code> architecture step for step. Starting from scratch, we create a bootable OS kernel, implement basic input/output support, show how to test and debug our kernel, explain virtual memory management, and add support for multitasking and userspace programs.</p> <p>In the following posts, we explain how to create an operating system for the <code>x86_64</code> architecture step for step. Starting from scratch, we create a bootable OS kernel, implement basic input/output support, show how to test and debug our kernel, explain virtual memory management, and add support for multitasking and userspace programs.</p>
--> -->
<div>
{%- set chapter = "none" -%} {%- set chapter = "none" -%}
{%- for post in posts -%} {%- for post in posts -%}
{%- if post.extra["chapter"] -%} {%- if post.extra["chapter"] != chapter -%}
{%- if post.extra["chapter"] != chapter -%} {%- if chapter != "none" -%}
{# Begin new chapter #} </ul></div>
{%- set_global chapter = post.extra["chapter"] -%}
</div>
{% set chapter_slug = chapter | slugify %}
<div class="posts {{chapter_slug}}">
{% set chapter_page = get_page(path = "edition-3/chapters/" ~ chapter_slug ~ ".md" ) %}
<h2>{{ chapter_page.title }}</h2>
{{ chapter_page.content | safe }}
{%- endif -%} {%- endif -%}
{# Begin new chapter #}
{%- set_global chapter = post.extra["chapter"] -%}
{% set chapter_slug = chapter | slugify %}
<div class="posts {{chapter_slug}}">
{% set chapter_page = get_page(path = "edition-3/chapters/" ~ chapter_slug ~ ".md" ) %}
<h2>{{ chapter_page.title }}</h2>
{{ chapter_page.content | safe }}
<ul>
{%- endif -%} {%- endif -%}
{{ macros::post_link_edition_3(page=post) }} <li>{{ macros::post_link_edition_3(page=post) }}</li>
{%- endfor -%} {%- endfor -%}
</div> </ul></div>
<hr> <hr>