Compare commits

...

3 Commits

Author SHA1 Message Date
Emil Miler 62eec7be80 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`.
3 years ago
Emil Miler 7a6a42d617 Figures and labels 3 years ago
Emil Miler 60fc2c7c57 Fix taxonomy listing 3 years ago

@ -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
+++

@ -47,6 +47,18 @@ aside ul li a:hover {
text-decoration: none;
}
main img {
max-width: 100%;
box-sizing: border-box;
border: 1px solid #bbb;
border-radius: .2rem;
padding: .2rem;
}
main p img + em {
display: block;
text-align: center;
}
main .info {
border-top: 1px solid #eee;
margin: 2em 0;

@ -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>
@ -19,7 +29,7 @@
<div class="taxonomy">
<ul>
{% for tag in page.taxonomies.tags %}
<li><a href="{{ get_taxonomy_url(kind="categories", name=tag) | safe }}">#{{ tag }}</a></li>
<li><a href="{{ get_taxonomy_url(kind="tags", name=tag) | safe }}">#{{ tag }}</a></li>
{% endfor %}
</ul>
</div>

Loading…
Cancel
Save