From a36a55151aaabca2634b1ef7e1b7e9c62360c719 Mon Sep 17 00:00:00 2001 From: Emil Miler Date: Sat, 21 Mar 2020 12:25:00 +0100 Subject: [PATCH] =?UTF-8?q?P=C5=99esunut=C3=AD=20v=C5=A1ech=20komponent=20?= =?UTF-8?q?do=20blok=C5=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to be able to access section font-matter from within a page, a section variable has to be set according to the page ancestor. All navigation blocks have to be regenerated from within the page context. --- templates/index.html | 32 ++++++++++++++++++-------------- templates/page.html | 26 ++++++++++++++++++++++++++ templates/section.html | 4 ++++ 3 files changed, 48 insertions(+), 14 deletions(-) diff --git a/templates/index.html b/templates/index.html index e8668b4..9066d90 100644 --- a/templates/index.html +++ b/templates/index.html @@ -12,27 +12,31 @@
{% block content%}{% endblock %} diff --git a/templates/page.html b/templates/page.html index 6fc3f6e..c6f1af5 100644 --- a/templates/page.html +++ b/templates/page.html @@ -1,5 +1,31 @@ {% extends "index.html" %} +{% block subtitle %} + {% set current_section = get_section(path=page.ancestors[1]) %} + {{ current_section.title }} +{% endblock %} + + {% block content %} {{ page.content | safe }} {% endblock %} + +{% block menu %} + {% set global_section = get_section(path="_index.md") %} + {% for s in global_section.subsections %} + {% set subsection = get_section(path=s) %} +
  • + {{ subsection.title }} +
  • + {% endfor %} +{% endblock %} + +{% block nav %} + {% if current_section.pages %} + + {% endif %} +{% endblock %} diff --git a/templates/section.html b/templates/section.html index 77397ce..7d36e58 100644 --- a/templates/section.html +++ b/templates/section.html @@ -1,5 +1,9 @@ {% extends "index.html" %} +{% block subtitle %} + {{ section.title }} +{% endblock %} + {% block content %}

    {{ section.title }}

    {{ section.content | safe }}