Kompletní přepsání systému pro správu sekcí

Aby bylo možné vnořovat potencionálně nekonečné množství vrstev uvitř
navigace, byl přepsán celý systém tak, aby generoval nazavující objekty
v navigaci cyklem. Veškerý obsah je řešen v rámci sekcí a šablony
nepočítají s původní koncepcí stránek.
master
Emil Miler 5 years ago
parent fbc1a7ce28
commit 9bab5b12a4

@ -2,8 +2,8 @@
base_url = "https://example.com"
# The site title and description; used in RSS by default.
title = "Title"
description = "Description"
title = "Učitel online"
description = "Web pro ditstribuci užitečných materiálů"
# Whether to automatically compile all Sass files in the sass directory
compile_sass = true

@ -1,3 +1,2 @@
+++
title="Section Title"
+++

@ -0,0 +1,3 @@
+++
title="Mateřská škola"
+++

@ -1,3 +0,0 @@
+++
title="Section 1"
+++

@ -1,5 +0,0 @@
+++
title="Page 1"
+++
{{ video(title="Video title",src="",author="Jane Doe",date="2019-12-24") }}

@ -1,3 +0,0 @@
+++
title="Page 2"
+++

@ -1,3 +0,0 @@
+++
title="Section 2"
+++

@ -0,0 +1,3 @@
+++
title="Základní a střední škola"
+++

@ -0,0 +1,3 @@
+++
title="Dějepis"
+++

@ -0,0 +1,3 @@
+++
title="Novověk"
+++

@ -0,0 +1,3 @@
+++
title="Ferdinand V."
+++

@ -0,0 +1,3 @@
+++
title="Kateřina veliká"
+++

@ -0,0 +1,3 @@
+++
title="Král slunce a jeho doba"
+++

@ -0,0 +1,3 @@
+++
title="Obraz Rudolfa II. ve filmu"
+++

@ -0,0 +1,3 @@
+++
title="Obrazy Kryštofa Kolumba"
+++

@ -0,0 +1,3 @@
+++
title="Pravěk a starověk"
+++

@ -0,0 +1,3 @@
+++
title="Otrok vs. římský voják"
+++

@ -0,0 +1,3 @@
+++
title="Středověk"
+++

@ -0,0 +1,3 @@
+++
title="Cyril a Metoděj"
+++

@ -0,0 +1,3 @@
+++
title="Kostnický koncil"
+++

@ -1,12 +0,0 @@
@media only screen and (max-width: 700px) {
#content {
flex-direction: column;
}
#nav {
border: 0;
border-bottom: 1px dotted #ccc;
width: 100%;
}
}

@ -53,29 +53,40 @@ body {
}
}
#content {
display: flex;
}
#nav {
float: left;
border-right: 1px dotted #ccc;
display: flex;
border-bottom: 1px dotted #ccc;
padding: 1em 0;
width: 200px;
width: 100%;
box-sizing: border-box;
ul li a {
display: block;
padding: .5em;
color: #000;
&:hover {
background-color: #ddd;
ul {
min-width: 25%;
a {
display: block;
padding: .5em 1em;
color: $primary;
&.ancestor {
background-color: #eee;
}
&:hover {
background-color: #ccc;
}
&.active {
background-color: $primary;
color: #fff;
}
}
}
}
#main {
clear: both;
padding: 1.5em;
flex-grow: 1;
@ -94,4 +105,3 @@ body {
}
}
@import "_media.scss";

@ -10,36 +10,35 @@
</head>
<body>
<div id="header">
{% set current_section = get_section(path="_index.md") %}
<a href="{{ config.base_url }}">{{ config.title }}</a>
<span class="subtitle">&ndash; {% block subtitle %}{{ config.description }}{% endblock %}</span>
<span class="subtitle">&ndash; {{ config.description }}</span>
</div>
<div id="menu">
<ul>
{% 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>
{% block menu %}
{% set global = get_section(path="_index.md") %} {# Always set a global section to `_index.md` #}
{# List all L1 sections #}
{% if global.subsections %}
<ul>
{% for s in global.subsections %}
{% set top = get_section(path=s) %} {# Set the L1 section #}
{% set current = section %} {# Set the section to a varibale, because `section.path` can not be used when nested #}
{% if section.ancestors[1] %} {# Check if ancestor exists (and therefore we are not in L1) #}
{% set current = get_section(path=section.ancestors[1]) %} {# Set the variable to the L1 ancestor #}
{% endif %}
<li{% if top.path == current.path %} class="active"{% endif %}><a href="{{ top.permalink }}">{{ top.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}
</div>
<div id="content">
{% block nav %}
{% if section.pages %}
<div id="nav">
<ul>
{% for post in section.pages %}
<li><a href="{{ post.permalink }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endblock %}
<div id="main">
{% block content%}{% endblock %}
{% block content%}
{{ section.content | safe }}
{% endblock %}
</div>
</div>
</body>

@ -1,34 +0,0 @@
{% extends "index.html" %}
{% block subtitle %}
{% set current_section = get_section(path=page.ancestors[1]) %}
{{ current_section.title }}
{% 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_section.path == subsection.path %}class="active"{% endif %}>
<a href="{{ subsection.permalink }}">{{ subsection.title }}</a>
</li>
{% endfor %}
{% endblock %}
{% block nav %}
{% if current_section.pages %}
<div id="nav">
<ul>
{% for post in current_section.pages %}
<li><a href="{{ post.permalink }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endblock %}
{% block content %}
<h1>{{ page.title }}</h1>
{{ page.content | safe }}
{% endblock %}

@ -1,11 +1,36 @@
{% extends "index.html" %}
{% block subtitle %}
{% if section.description %}
{{ section.description }}
{% else %}
{{ section.title }}
{% block title %}{{ config.title }} &ndash; {{ section.title }}{% endblock %}
{% block nav %}
<div id="nav">
{% if section.ancestors %} {# List all ancestors #}
{% for s in section.ancestors %}
{% if loop.index < 2 %}{% continue %}{% endif %}
<ul>
{% set s = get_section(path=s) %}
{% for s in s.subsections %}
{% set s = get_section(path=s) %}
<li><a href="{{ s.permalink }}"
{% if current_path == s.path %}
class="active"
{% elif current_path is containing(s.path) %}
class="ancestor"
{% endif %}
>{{ s.title }}</a></li>
{% endfor %}
</ul>
{% endfor %}
{% endif %}
{% if section.subsections %} {# list all direct subsections #}
<ul>
{% for s in section.subsections %}
{% set s = get_section(path=s) %}
<li><a href="{{ s.permalink }}">{{ s.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endblock %}
{% block content %}