custom config parameters via themes

9 views
Skip to first unread message

Gour

unread,
Sep 6, 2017, 3:36:10 AM9/6/17
to nikola-...@googlegroups.com
Hello,

Nikola plugins can add custom parameters to the config file - e.g. Asciidoc
plugin has the following line:

binary = self.site.config.get('ASCIIDOC_BINARY', 'asciidoc')

which references ASCIIDOC_BINARY that can ber set in conf.py.

Now I wonder if there is possibility to do the same with themes, iow.

set something like:

PIWIK_ID = "foo"

PIWIK_URL = "bar"

and then have access to them within theme's templates?


Sincerely,
Gour

--
One who restrains his senses, keeping them under full control,
and fixes his consciousness upon Me, is known as a man of
steady intelligence.


Chris Warrick

unread,
Sep 6, 2017, 3:51:28 AM9/6/17
to Nikola—Discuss
On 6 September 2017 at 09:35, Gour <go...@atmarama.com> wrote:
> Hello,
>
> Nikola plugins can add custom parameters to the config file - e.g. Asciidoc
> plugin has the following line:
>
> binary = self.site.config.get('ASCIIDOC_BINARY', 'asciidoc')
>
> which references ASCIIDOC_BINARY that can ber set in conf.py.
>
> Now I wonder if there is possibility to do the same with themes, iow.
>
> set something like:
>
> PIWIK_ID = "foo"
>
> PIWIK_URL = "bar"
>
> and then have access to them within theme's templates?

GLOBAL_CONTEXT = {"PIWIK_ID": "foo", "PIWIK_URL": "bar"}

--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

Gour

unread,
Sep 6, 2017, 4:10:01 AM9/6/17
to nikola-...@googlegroups.com
On Wed, 6 Sep 2017 09:51:27 +0200
Chris Warrick <kwpo...@gmail.com> wrote:

> GLOBAL_CONTEXT = {"PIWIK_ID": "foo", "PIWIK_URL": "bar"}

Perfect. That's really powerful!


Sincerely,
Gour

--
The senses are so strong and impetuous, O Arjuna,
that they forcibly carry away the mind even of a man
of discrimination who is endeavoring to control them.


Reply all
Reply to author
Forward
0 new messages