From 70464c2fc25c067390acf28cf1e39ea9c5a49e3d Mon Sep 17 00:00:00 2001 From: Paul Winkler Date: Sun, 9 Jul 2023 02:07:35 -0400 Subject: [PATCH] Gum: Add settings for adding extra local and/or remote CSS and/or JS --- gum/README.md | 19 ++++++++++++++++++- gum/templates/base.html | 22 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/gum/README.md b/gum/README.md index 75091c02..f52a822f 100644 --- a/gum/README.md +++ b/gum/README.md @@ -44,16 +44,33 @@ To use Disqus, add the Disqus site name via the following variable. DISQUS_SITENAME = '' ``` - To add content or markup to the footer of every page: Add an `extra_footer.html` file to a directory in your `THEME_TEMPLATES_OVERRIDES` path. It is empty by default. +To add extra CSS, for example to override styles without forking the Gum theme, +>>>>>>> 2707d51 (Documentation tweaks from review feedback) +you may specify either or both of these settings: + +``` +CUSTOM_CSS_FILES = ['list of paths to additional css static files'] +CUSTOM_CSS_URLS = ['list of URLs of additional remote css to load'] +``` + +To add extra Javascript to the theme, you may specify either or both of these settings: + +``` +CUSTOM_JS_FILES = ['list of paths to additional JavaScript static files'] +CUSTOM_JS_URLS = ['list of URLs of additional JavaScript to load'] + +``` + Other features include: ``` SITESUBTITLE = 'your site subtitle' ``` + The following standard Pelican settings are honored: ``` diff --git a/gum/templates/base.html b/gum/templates/base.html index bb455491..1e0b7834 100644 --- a/gum/templates/base.html +++ b/gum/templates/base.html @@ -37,6 +37,17 @@ + {% if CUSTOM_CSS_FILES %} + {% for item in CUSTOM_CSS_FILES %} + + {% endfor %} + {% endif %} + + {% if CUSTOM_CSS_URLS %} + {% for item in CUSTOM_CSS_URLS %} + + {% endfor %} + {% endif %} @@ -70,6 +81,17 @@ {% endif %} + {% if CUSTOM_JS_FILES %} + {% for item in CUSTOM_JS_FILES %} + + {% endfor %} + {% endif %} + {% if CUSTOM_JS_URLS %} + {% for item in CUSTOM_JS_URLS %} + + {% endfor %} + {% endif %} + {% endblock head %}