diff --git a/blog/content/_index.md b/blog/content/_index.md new file mode 100644 index 00000000..493e0c96 --- /dev/null +++ b/blog/content/_index.md @@ -0,0 +1,13 @@ ++++ +template = "edition-2/index.html" ++++ + +

Writing an OS in Rust

+ +
+ +This blog series creates a small operating system in the [Rust programming language](https://www.rust-lang.org/). Each post is a small tutorial and includes all needed code, so you can follow along if you like. The source code is also available in the corresponding [Github repository](https://github.com/phil-opp/blog_os). + +Latest post: + +
diff --git a/blog/templates/edition-1/index.html b/blog/templates/edition-1/index.html index 31d4aae7..0d8a68ab 100644 --- a/blog/templates/edition-1/index.html +++ b/blog/templates/edition-1/index.html @@ -1,6 +1,6 @@ {% extends "edition-1/base.html" %} -{% import "macros.html" as macros %} +{% import "edition-1/macros.html" as macros %} {% block title %}{{ config.title }}{% endblock title %} diff --git a/blog/templates/edition-1/macros.html b/blog/templates/edition-1/macros.html new file mode 100644 index 00000000..a6197dad --- /dev/null +++ b/blog/templates/edition-1/macros.html @@ -0,0 +1,39 @@ +{% macro post_link(page) %} + {% set translations = page.translations | filter(attribute="lang", value=lang) -%} + {%- if translations -%} + {%- set post = get_page(path = translations.0.path) -%} + {%- else -%} + {%- set post = page -%} + {%- set not_translated = true -%} + {%- endif -%} + +

{{ post.title }}

+
+ {{ post.summary | safe }} + read more ยป + + {%- if lang and not_translated and lang != config.default_language -%} + + {%- endif -%} +
+ +{% endmacro post_link %} + +{% macro toc(toc) %} +
+ Table of Contents + +
+{% endmacro toc %} diff --git a/blog/templates/edition-1/section.html b/blog/templates/edition-1/section.html index 3bbe0a8a..45d12fa3 100644 --- a/blog/templates/edition-1/section.html +++ b/blog/templates/edition-1/section.html @@ -1,6 +1,6 @@ {% extends "edition-1/base.html" %} -{% import "macros.html" as macros %} +{% import "edition-1/macros.html" as macros %} {% block title %}{{ section.title }} | {{ config.title }}{% endblock title %} diff --git a/blog/templates/edition-2/extra.html b/blog/templates/edition-2/extra.html index bdd5a16a..93c98f59 100644 --- a/blog/templates/edition-2/extra.html +++ b/blog/templates/edition-2/extra.html @@ -1,6 +1,6 @@ {% extends "edition-2/base.html" %} -{% import "macros.html" as macros %} +{% import "snippets.html" as snippets %} {% block title %}{{ page.title }} | {{ config.title }}{% endblock title %} @@ -17,6 +17,6 @@

Comments

- {{ macros::utterances() }} + {{ snippets::utterances() }}
{% endblock after_main %} diff --git a/blog/templates/edition-2/index.html b/blog/templates/edition-2/index.html index b8303d4b..4c893f5c 100644 --- a/blog/templates/edition-2/index.html +++ b/blog/templates/edition-2/index.html @@ -1,6 +1,7 @@ {% extends "edition-2/base.html" %} -{% import "macros.html" as macros %} +{% import "edition-2/macros.html" as macros %} +{% import "snippets.html" as snippets %} {% block title %}{{ config.title }}{% endblock title %} @@ -8,20 +9,10 @@ {% set posts_section = get_section(path = "edition-2/posts/_index.md") %} {% set posts = posts_section.pages %} -

Writing an OS in Rust

- -
-

- This blog series creates a small operating system in the - Rust programming language. Each post is a small tutorial and includes all - needed code, so you can follow along if you like. The source code is also available in the corresponding - Github repository. -

-

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

-
+{{ section.content + | replace(from="", to=macros::latest_post(posts=posts)) + | safe +}}
{%- set chapter = "none" -%} @@ -71,7 +62,7 @@

Support Me

- {% include "support.html" %} + {{ snippets::support() }}
{% endblock main %} diff --git a/blog/templates/macros.html b/blog/templates/edition-2/macros.html similarity index 85% rename from blog/templates/macros.html rename to blog/templates/edition-2/macros.html index a7c700a9..a28a44bb 100644 --- a/blog/templates/macros.html +++ b/blog/templates/edition-2/macros.html @@ -1,3 +1,8 @@ +{% macro latest_post(posts) %} + {% set post = posts|last %} + {{ post.title }} +{% endmacro latest_post %} + {% macro post_link(page) %} {% set translations = page.translations | filter(attribute="lang", value=lang) -%} {%- if translations -%} @@ -21,16 +26,6 @@
{% endmacro post_link %} -{% macro utterances() %} - -{% endmacro utterances %} - {% macro toc(toc) %}
Table of Contents diff --git a/blog/templates/edition-2/page.html b/blog/templates/edition-2/page.html index ef440314..13a70d79 100644 --- a/blog/templates/edition-2/page.html +++ b/blog/templates/edition-2/page.html @@ -1,6 +1,7 @@ {% extends "edition-2/base.html" %} -{% import "macros.html" as macros %} +{% import "edition-2/macros.html" as macros %} +{% import "snippets.html" as snippets %} {% block title %}{{ page.title }} | {{ config.title }}{% endblock title %} {% block header %} @@ -75,7 +76,7 @@
@@ -98,7 +99,7 @@

{% endif %} - {{ macros::utterances() }} + {{ snippets::utterances() }}