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
parent
025109fb8c
commit
a36a55151a
@ -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 %}
|
||||
|
Reference in New Issue