From 63e4576c4a64a677c92ac7648cc3e90e106ddbc0 Mon Sep 17 00:00:00 2001 From: Vitaly Potyarkin Date: Thu, 19 Sep 2019 14:24:09 +0300 Subject: [PATCH] Add configuration parameter to override the stylesheet This commit adds new configuration parameter, THEME_CSS_OVERRIDES, which can contain a sequence (list, tuple, etc) of URLs to extra stylesheets that will be used to override default theme appearance. Both absolute and relative URLs are supported. It makes the theme more flexible by allowing small stylesheet tweaks without requiring to maintain a fork of the whole theme. When this parameter is not set the theme behaves same as before. --- README.md | 2 ++ alchemy/templates/base.html | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 81c1fef..e9ff8fa 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,8 @@ Visit the [Settings wiki](https://github.com/nairobilug/pelican-alchemy/wiki/Set - **PYGMENTS_STYLE**: Built-in Pygments style for syntax highlighting. - **HIDE_AUTHORS**: Hide the author(s) of an article - useful for single author sites. - **RFG_FAVICONS**: Use a Favicon Generator package. +- **THEME_CSS_OVERRIDES**: Sequence of stylesheet URLs to override CSS provided by theme. + Both relative and absolute URLs are supported. Misc settings: diff --git a/alchemy/templates/base.html b/alchemy/templates/base.html index 4847a02..cc7d711 100644 --- a/alchemy/templates/base.html +++ b/alchemy/templates/base.html @@ -21,6 +21,13 @@ + {% for stylesheet in THEME_CSS_OVERRIDES or () %} + {% if stylesheet|lower|truncate(4, True, '') == 'http' %} + + {% else %} + + {% endif %} + {% endfor %} {% include 'include/xml_feeds.html' %} {% block head %}{% endblock %}