I am making a pelican plugin and I'm having trouble adding variables to the templates.
For example in my plugin's code:
def baz(generator):
generator.foo = 'bar'
def register():
signals.generator_init.connect(baz)
And in my templates I have:
<h1>lorem - {{foo}}</h1>
And I would expect lorem - bar
to show in the <h1>
.
I have been looking at https://github.com/getpelican/pelican/blob/807b3bced38bff7b83a2efa2ce8cda9d644ebad3/pelican/generators.py trying to see how I can add this as an environment variable to no avail. Any help is much appreciated.
What I needed was
generator.context['foo'] = 'bar'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With