chiark / gitweb /
theme: support for page breadcrumb attributes.
authorVladimír Vondruš <mosra@centrum.cz>
Tue, 19 Sep 2017 19:22:23 +0000 (21:22 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Wed, 11 Oct 2017 19:54:40 +0000 (21:54 +0200)
pelican-theme/templates/page.html

index 01a9c1e39f0eecf4e1a4d151b75a1e078e46a881..2032cc5e926e5639946843dcf70ee7158ccfeabb 100644 (file)
@@ -1,7 +1,13 @@
 {% set page_title = page.title %}
 {% extends "base.html" %}
 
-{% block title %}{{ page.title }} | {{ SITENAME }}{% endblock %}
+{% block title %}
+{% if page.breadcrumb %}
+{% set breadcrumbs = page.breadcrumb.strip().split('\n') %}
+{% for i in breadcrumbs %}{% set url, _, title = i.strip().partition(' ') %}{{ title }} &raquo; {% endfor %}
+{% endif %}
+{{ page.title }} | {{ SITENAME -}}
+{% endblock %}
 
 {% block head %}
   {{- super() -}}
 <article class="m-container" id="m-container-inflatable">
   <div class="m-row">
     <div class="m-col-l-10 m-push-l-1">
-      <h1>{{ page.title }}</h1>
+      {% if not page.landing %}
+      <h1>
+        {% if page.breadcrumb %}
+        <span class="m-breadcrumb">
+          {% set breadcrumbs = page.breadcrumb.strip().split('\n') %}
+          {% for i in breadcrumbs %}
+          {% set url, _, title = i.strip().partition(' ') %}
+          <a href="{{ url|expand_link(page) }}">{{ title }}</a> &raquo;
+          {% endfor %}
+        </span>
+        {% endif %}
+        {{ page.title }}
+      </h1>
 <!-- content -->
 {{ page.content -}}
 <!-- /content -->