From: Vladimír Vondruš Date: Fri, 12 Oct 2018 19:08:41 +0000 (+0200) Subject: theme: make it possible to add JS files and arbitrary HTML to page head. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=d1654c35ae042c6c8144f50528639cdffc541a16;p=blog.git theme: make it possible to add JS files and arbitrary HTML to page head. --- diff --git a/doc/pelican/theme.rst b/doc/pelican/theme.rst index c7603cd8..478757b0 100644 --- a/doc/pelican/theme.rst +++ b/doc/pelican/theme.rst @@ -337,11 +337,15 @@ Pages can override which menu item in the `top navbar`_ will be highlighted by specifying the corresponding menu item slug in the :rst:`:highlight:` field. If the field is not present, page's own slug is used instead. -`Extra CSS`_ ------------- +`Extending HTML \`_ +-------------------------- The :rst:`:css:` field can be used to link additional CSS files in page header. -Put one URL per line, internal link targets are expanded. Example: +Put one URL per line, internal link targets are expanded. Similarly :rst:`:js:` +can be used to link JavaScript files. Besides that, the :rst:`:html_header:` +field can be used to put arbitrary HTML at the end of the :html:`` +element. Indenting the lines is possible by putting an escaped space in front +(the backslash and the escaped space itself won't get inserted). Example: .. code:: rst @@ -351,6 +355,15 @@ Put one URL per line, internal link targets are expanded. Example: :css: {filename}/static/webgl.css {filename}/static/canvas-controls.css + :js: + {filename}/static/showcase.js + :html_header: + `Breadcrumb navigation`_ ------------------------ diff --git a/pelican-theme/templates/base.html b/pelican-theme/templates/base.html index 9c9930d7..de99b0de 100644 --- a/pelican-theme/templates/base.html +++ b/pelican-theme/templates/base.html @@ -36,6 +36,8 @@ {% block social %} {% endblock social %} {% endif %} + {% block extra %} + {% endblock extra %}