mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Add Multi-theme support
Adds multi-theme support using the new THEMES setting. You can specify all the themes that you will be using in python dicionary form. You can then inherit from the themes specified in THEMES using the corresponding key in the dictionary.
This commit is contained in:
parent
369b8b8474
commit
b00d9ef6d1
8 changed files with 119 additions and 41 deletions
|
|
@ -720,6 +720,12 @@ Setting name (followed by default value, if any) What does it do?
|
|||
the paths defined in this settings, they will be
|
||||
progressively overwritten.
|
||||
``CSS_FILE = 'main.css'`` Specify the CSS file you want to load.
|
||||
``THEMES = {}`` Extra themes that can be inherited from. They can also
|
||||
inherit from each other. Use a dictionary to make a list
|
||||
of all the available list. The key in the dictionary will
|
||||
also be the prefix you use to inherit from the theme.
|
||||
|
||||
Example: ``THEMES = {'!foo': foo, '!foobar':foobar}``
|
||||
================================================ =====================================================
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -350,15 +350,22 @@ Here is a complete list of the feed variables::
|
|||
Inheritance
|
||||
===========
|
||||
|
||||
Since version 3.0, Pelican supports inheritance from the ``simple`` theme, so
|
||||
you can re-use the ``simple`` theme templates in your own themes.
|
||||
Since version 3.4, Pelican supports inheritance from the ``simple`` theme, as well
|
||||
as any themes specified in the ``THEMES`` setting. You can re-use
|
||||
their theme templates in your own themes.
|
||||
|
||||
Implicit Inheritance
|
||||
--------------------
|
||||
|
||||
If one of the mandatory files in the ``templates/`` directory of your theme is
|
||||
missing, it will be replaced by the matching template from the ``simple`` theme.
|
||||
So if the HTML structure of a template in the ``simple`` theme is right for you,
|
||||
you don't have to write a new template from scratch.
|
||||
|
||||
You can also extend templates from the ``simple`` theme in your own themes by
|
||||
Explicit Inheritance
|
||||
--------------------
|
||||
|
||||
You explicitly extend templates from the ``simple`` themes in your own themes by
|
||||
using the ``{% extends %}`` directive as in the following example:
|
||||
|
||||
.. code-block:: html+jinja
|
||||
|
|
@ -367,6 +374,16 @@ using the ``{% extends %}`` directive as in the following example:
|
|||
|
||||
{% extends "index.html" %} <!-- "regular" extending -->
|
||||
|
||||
You can extend from a user created theme by adding that theme to the ``THEMES``
|
||||
setting.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
THEMES = {'!foo': 'foo'}
|
||||
|
||||
.. code-block:: html+jinja
|
||||
|
||||
{% extends "!foo/index.html" %} <!-- extends the ``index.html`` template from the ``foo`` theme -->
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue