Custom headers (#19)

* added custom headers for page, tag and category templates

* fixed readme

* fixed readme

* removed HEADER_COVER_BY_PAGE
This commit is contained in:
beleriandcrises 2018-04-29 03:05:06 +02:00 committed by Arul
parent 472f835f9a
commit 994b999633
3 changed files with 21 additions and 2 deletions

View file

@ -86,6 +86,21 @@ This is site level cover image and it will be used If there is no cover
image set in link:#articles[article] level.
[[header-color]]
==== Custom Header Covers
For each page, category page, tag page or author page you can set a custom header cover.
To define it, just set the following properties in `pelicanconf.py`
Use the page title as defined in metadata for the pages
[source,python]
----
HEADER_COVERS_BY_TAG = {'food': '/images/food.png', 'drinks':'/images/orange-juice.png'}
HEADER_COVERS_BY_CATEGORY = {'food': '/images/junkie-stuff.png'}
----
=== Header Color
To define a simple header background color, set the property

View file

@ -23,7 +23,9 @@
</nav>
<h1 class="post-title">Category {{ category }}</h1>
<span class="blog-description">Posts: {{ articles|count }}</span>
{% if HEADER_COVER %}
{% if category in HEADER_COVERS_BY_CATEGORY %}
<div class="blog-cover cover" style="background-image: url('{{ HEADER_COVERS_BY_CATEGORY.get(category) }}')">
{% elif HEADER_COVER %}
<div class="blog-cover cover" style="background-image: url('{{ HEADER_COVER }}')">
{% elif HEADER_COLOR %}
<div class="post-cover cover" style="background-color: {{ HEADER_COLOR }}">

View file

@ -22,7 +22,9 @@
</nav>
<h1 class="post-title">Tag {{ tag }}</h1>
<span class="blog-description">Posts: {{ articles|count }}</span>
{% if HEADER_COVER %}
{% if tag in HEADER_COVERS_BY_TAG %}
<div class="blog-cover cover" style="background-image: url('{{ HEADER_COVERS_BY_TAG.get(tag) }}')">
{% elif HEADER_COVER %}
<div class="blog-cover cover" style="background-image: url('{{ HEADER_COVER }}')">
{% elif HEADER_COLOR %}
<div class="post-cover cover" style="background-color: {{ HEADER_COLOR }}">