From 994b999633dee4a6699eaafedd607ca2a0a40174 Mon Sep 17 00:00:00 2001 From: beleriandcrises Date: Sun, 29 Apr 2018 03:05:06 +0200 Subject: [PATCH] Custom headers (#19) * added custom headers for page, tag and category templates * fixed readme * fixed readme * removed HEADER_COVER_BY_PAGE --- README.adoc | 15 +++++++++++++++ templates/category.html | 4 +++- templates/tag.html | 4 +++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.adoc b/README.adoc index 83782a6..60acb21 100644 --- a/README.adoc +++ b/README.adoc @@ -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 diff --git a/templates/category.html b/templates/category.html index 9f90e54..546e6b5 100644 --- a/templates/category.html +++ b/templates/category.html @@ -23,7 +23,9 @@

Category {{ category }}

Posts: {{ articles|count }} - {% if HEADER_COVER %} + {% if category in HEADER_COVERS_BY_CATEGORY %} +
+ {% elif HEADER_COVER %}
{% elif HEADER_COLOR %}
diff --git a/templates/tag.html b/templates/tag.html index 386d807..a2288c5 100644 --- a/templates/tag.html +++ b/templates/tag.html @@ -22,7 +22,9 @@

Tag {{ tag }}

Posts: {{ articles|count }} - {% if HEADER_COVER %} + {% if tag in HEADER_COVERS_BY_TAG %} +
+ {% elif HEADER_COVER %}
{% elif HEADER_COLOR %}