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 4 years ago
parent 025109fb8c
commit a36a55151a

@ -12,27 +12,31 @@
<div id="header">
{% set current_section = get_section(path="_index.md") %}
<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 id="menu">
<ul>
{% for s in current_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 %}
{% block menu %}
{% for s in current_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 %}
</ul>
</div>
<div id="content">
<div id="nav">
{% if section.pages %}
<ul>
{% for post in section.pages %}
<li><a href="{{ post.permalink }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% block nav %}
{% if section.pages %}
<ul>
{% for post in section.pages %}
<li><a href="{{ post.permalink }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}
</div>
<div id="main">
{% block content%}{% endblock %}

@ -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) %}
<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" %}
{% block subtitle %}
{{ section.title }}
{% endblock %}
{% block content %}
<h1>{{ section.title }}</h1>
{{ section.content | safe }}