Přesunutí všech komponent do bloků

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.
master
Emil Miler 5 years ago
parent 025109fb8c
commit a36a55151a

@ -12,20 +12,23 @@
<div id="header"> <div id="header">
{% set current_section = get_section(path="_index.md") %} {% set current_section = get_section(path="_index.md") %}
<a href="{{ config.base_url }}">{{ config.title }}</a> <a href="{{ config.base_url }}">{{ config.title }}</a>
<span class="subtitle">{{ current_section.title }}</span> <span class="subtitle">{% block subtitle %}{{ current_section.title }}{% endblock %}</span>
</div> </div>
<div id="menu"> <div id="menu">
<ul> <ul>
{% block menu %}
{% for s in current_section.subsections %} {% for s in current_section.subsections %}
{% set subsection = get_section(path=s) %} {% set subsection = get_section(path=s) %}
<li {% if current_path == subsection.path %}class="active"{% endif %}> <li {% if current_path == subsection.path %}class="active"{% endif %}>
<a href="{{ subsection.permalink }}">{{ subsection.title }}</a> <a href="{{ subsection.permalink }}">{{ subsection.title }}</a>
</li> </li>
{% endfor %} {% endfor %}
{% endblock %}
</ul> </ul>
</div> </div>
<div id="content"> <div id="content">
<div id="nav"> <div id="nav">
{% block nav %}
{% if section.pages %} {% if section.pages %}
<ul> <ul>
{% for post in section.pages %} {% for post in section.pages %}
@ -33,6 +36,7 @@
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}
{% endblock %}
</div> </div>
<div id="main"> <div id="main">
{% block content%}{% endblock %} {% block content%}{% endblock %}

@ -1,5 +1,31 @@
{% extends "index.html" %} {% extends "index.html" %}
{% block subtitle %}
{% set current_section = get_section(path=page.ancestors[1]) %}
{{ current_section.title }}
{% endblock %}
{% block content %} {% block content %}
{{ page.content | safe }} {{ page.content | safe }}
{% endblock %} {% endblock %}
{% block menu %}
{% set global_section = get_section(path="_index.md") %}
{% for s in global_section.subsections %}
{% set subsection = get_section(path=s) %}
<li {% if current_path == subsection.path %}class="active"{% endif %}>
<a href="{{ subsection.permalink }}">{{ subsection.title }}</a>
</li>
{% endfor %}
{% endblock %}
{% block nav %}
{% if current_section.pages %}
<ul>
{% for post in current_section.pages %}
<li><a href="{{ post.permalink }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}

@ -1,5 +1,9 @@
{% extends "index.html" %} {% extends "index.html" %}
{% block subtitle %}
{{ section.title }}
{% endblock %}
{% block content %} {% block content %}
<h1>{{ section.title }}</h1> <h1>{{ section.title }}</h1>
{{ section.content | safe }} {{ section.content | safe }}