Change content structure

In order to be able to create simple pages, the structure has been
redesigned. All blog posts are in their separate section.

The sacrifice for this is that pagination of posts does not work on
index. This could have been fixed with `transparent=true` in the posts
section, but index would then paginate all other pages as well (for
instance about.md) and include them with the other posts.

A new macro `posts_latest` has been implemented to print last n posts as
specified in `config.toml`.
master
Emil Miler 4 years ago
parent 7a6a42d617
commit 62eec7be80

@ -15,7 +15,10 @@ taxonomies = [
[extra]
nav = [
{title = "Index", path = "/"},
{title = "About", path = "/about/"}
{title = "About", path = "/about/"},
{title = "All posts", path = "/posts/"},
{title = "Machines", path = "/machines/"}
]
categories_title = "Categories"
tags_title = "Tags"
latest_posts_count = 4

@ -1,5 +1,2 @@
+++
sort_by = "date"
paginate_by = 4
+++

@ -0,0 +1,4 @@
+++
title = "About"
+++

@ -1,5 +0,0 @@
+++
title = "About"
template = "section.html"
+++

@ -0,0 +1,5 @@
+++
orger_by = "date"
paginate_by = 5
+++

@ -25,10 +25,7 @@
</aside>
<main>
{% block content %}
{% for page in paginator.pages %}
{{ macros::list_article(page=page) }}
{% endfor %}
{{ macros::pagination(paginator=paginator) }}
{{ macros::posts_latest(section="posts", count=config.extra.latest_posts_count) }}
{% endblock content %}
</main>
</body>

@ -1,3 +1,13 @@
{% macro posts_latest(section, count) %}
{% set section = get_section(path=section~"/_index.md") %}
{% for page in section.pages %}
{% if loop.index > count %}
{% break %}
{% endif %}
{{ macros::list_article(page=page) }}
{% endfor %}
{% endmacro posts_latest %}
{% macro list_taxonomy(title, kind) %}
<span class="title">{{ title }}</span>
<ul>

Loading…
Cancel
Save