| --- |
| layout: base |
| --- |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| {% if page.sub-nav-group and page.sub-nav-parent != "_root_" %} |
| {% comment %} |
| The plain layout with a sub navigation. |
| |
| - This is activated via the 'sub-nav-group' field in the preemble. |
| - All pages of this sub nav group will be displayed in the sub navigation: |
| * Each element without a 'sub-nav-parent' field will be displayed on the 1st level, where the position is defined via 'sub-nav-pos'. |
| * If the page should be displayed as a child element, it needs to specify a 'sub-nav-parent' field, which matches the 'sub-nav-id' of its parent. The parent only needs to specify this if it expects child nodes. |
| {% endcomment %} |
| <div class="row"> |
| <!-- Sub Navigation --> |
| <div class="col-sm-3"> |
| <ul id="sub-nav"> |
| {% comment %} Get all pages belonging to this group sorted by their position {% endcomment %} |
| {% assign group = (site.pages | where: "sub-nav-group" , page.sub-nav-group | where: "sub-nav-parent", "_root_" | sort:"sub-nav-pos") %} |
| {% for group_page in group %} |
| {% if group_page.sub-nav-id %} |
| {% assign sub_group = (site.pages | where: "sub-nav-group" , page.sub-nav-group | where: "sub-nav-parent" , group_page.sub-nav-id | sort: "sub-nav-pos") %} |
| {% else %} |
| {% assign sub_group = nil %} |
| {% endif %} |
| <li><a href="{{ site.baseurl }}{{ group_page.url }}" class="{% if page.url contains group_page.url %}active{% endif %}">{% if group_page.sub-nav-title %}{{ group_page.sub-nav-title }}{% else %}{{ group_page.title }}{% endif %}</a> |
| {% if sub_group %} |
| <ul> |
| {% for sub_group_page in sub_group %} |
| {% if sub_group_page.sub-nav-id %} |
| {% assign sub_sub_group = (site.pages | where: "sub-nav-group", page.sub-nav-group | where: "sub-nav-parent", sub_group_page.sub-nav-id | sort: "sub-nav-pos") %} |
| {% else %} |
| {% assign sub_sub_group = nil %} |
| {% endif %} |
| <li> |
| <a href="{{ site.baseurl }}{{ sub_group_page.url }}" class="{% if page.url contains sub_group_page.url %}active{% endif %}"> |
| {% if sub_group_page.sub-nav-title %}{{ sub_group_page.sub-nav-title }}{% else %}{{ sub_group_page.title }}{% endif %} |
| </a> |
| {% if sub_sub_group %} |
| <ul> |
| {% for sub_sub_group_page in sub_sub_group %} |
| {% assign item_active = (page.url contains sub_sub_group_page.url or (sub_sub_group_page.sub-nav-id and page.sub-nav-parent and sub_sub_group_page.sub-nav-id == sub_group_page.sub-nav-parent)) %} |
| <li> |
| <a href="{{ site.baseurl }}{{ sub_sub_group_page.url }}" class="{% if item_active %}active{% endif %}"> |
| {% if sub_sub_group_page.sub-nav-title %}{{ sub_sub_group_page.sub-nav-title }}{% else %}{{ sub_sub_group_page.title }}{% endif %} |
| </a> |
| </li> |
| {% endfor %} |
| </ul> |
| {% endif %} |
| </li> |
| {% endfor %} |
| </ul> |
| {% endif %} |
| </li> |
| {% endfor %} |
| </ul> |
| </div> |
| <!-- Main --> |
| <div class="col-sm-9"> |
| <!-- Top anchor --> |
| <a href="#top"></a> |
| |
| <!-- Breadcrumbs above the main heading --> |
| <ol class="breadcrumb"> |
| |
| {% if page.sub-nav-parent %} |
| {% assign parent = (site.pages | where: "sub-nav-group" , page.sub-nav-group | where: "sub-nav-id" , page.sub-nav-parent | first) %} |
| {% if parent %} |
| |
| {% if parent.sub-nav-parent %} |
| {% assign grandparent = (site.pages | where: "sub-nav-group" , page.sub-nav-group | where: "sub-nav-id" , parent.sub-nav-parent | first) %} |
| |
| {% if grandparent %} |
| <li><a href="{{ site.baseurl }}{{ grandparent.url }}">{% if grandparent.sub-nav-title %}{{ grandparent.sub-nav-title }}{% else %}{{ grandparent.title }}{% endif %}</a></li> |
| {% endif %} |
| |
| {% endif %} |
| |
| <li><a href="{{ site.baseurl }}{{ parent.url }}">{% if parent.sub-nav-title %}{{ parent.sub-nav-title }}{% else %}{{ parent.title }}{% endif %}</a></li> |
| {% endif %} |
| {% endif %} |
| <li class="active">{% if page.sub-nav-title %}{{ page.sub-nav-title }}{% else %}{{ page.title }}{% endif %}</li> |
| </ol> |
| |
| <div class="text"> |
| <!-- Content --> |
| {{ content }} |
| </div> |
| </div> |
| </div> |
| {% else %} |
| <div class="col-md-8 col-md-offset-2"> |
| {{ content }} |
| </div> |
| {% endif %} |
| |