Add more blocks to simple base template

This change makes it easier to create new themes by inheriting from the
simple theme. It allows customization of the whole body (while still
making use of the theme’s head), or individual parts of the body like
header, menu, or footer.
This commit is contained in:
Frederik Elwert 2024-10-10 14:10:12 +02:00
commit d813c5148e

View file

@ -40,33 +40,41 @@
</head>
<body>
<header>
<hgroup><h1><a href="{{ SITEURL }}/">{{ SITENAME }}</a></h1>{% if SITESUBTITLE %}<p>{{ SITESUBTITLE }}</p>{% endif %}</hgroup>
<nav><ul>
{% for title, link in MENUITEMS %}
<li><a href="{{ link }}">{{ title }}</a></li>
{% endfor %}
{% if DISPLAY_PAGES_ON_MENU %}
{% for p in pages %}
<li><a href="{{ SITEURL }}/{{ p.url }}" {% if p==page %} aria-current="page" {% endif %}>{{ p.title }}</a></li>
{% endfor %}
{% endif %}
{% if DISPLAY_CATEGORIES_ON_MENU %}
{% for cat, null in categories %}
<li><a href="{{ SITEURL }}/{{ cat.url }}" {% if cat==category %} aria-current="page" {% endif %}>{{ cat}}</a></li>
{% endfor %}
{% endif %}
</ul></nav>
</header>
<main>
{% block content %}
{% endblock %}
</main>
<footer>
<address>
Proudly powered by <a rel="nofollow" href="https://getpelican.com/">Pelican</a>,
which takes great advantage of <a rel="nofollow" href="https://www.python.org/">Python</a>.
</address>
</footer>
{% block body %}
<header>
{% block header %}
<hgroup><h1><a href="{{ SITEURL }}/">{{ SITENAME }}</a></h1>{% if SITESUBTITLE %}<p>{{ SITESUBTITLE }}</p>{% endif %}</hgroup>
{% endblock %}
{% block nav %}
<nav><ul>
{% for title, link in MENUITEMS %}
<li><a href="{{ link }}">{{ title }}</a></li>
{% endfor %}
{% if DISPLAY_PAGES_ON_MENU %}
{% for p in pages %}
<li><a href="{{ SITEURL }}/{{ p.url }}" {% if p==page %} aria-current="page" {% endif %}>{{ p.title }}</a></li>
{% endfor %}
{% endif %}
{% if DISPLAY_CATEGORIES_ON_MENU %}
{% for cat, null in categories %}
<li><a href="{{ SITEURL }}/{{ cat.url }}" {% if cat==category %} aria-current="page" {% endif %}>{{ cat}}</a></li>
{% endfor %}
{% endif %}
</ul></nav>
{% endblock %}
</header>
<main>
{% block content %}
{% endblock %}
</main>
<footer>
{% block footer %}
<address>
Proudly powered by <a rel="nofollow" href="https://getpelican.com/">Pelican</a>,
which takes great advantage of <a rel="nofollow" href="https://www.python.org/">Python</a>.
</address>
{% endblock %}
</footer>
{% endblock %}
</body>
</html>