getnikola / nikola-themes

Themes for Nikola
https://themes.getnikola.com/
71 stars 52 forks source link

[hack] #191

Closed plum closed 4 years ago

plum commented 4 years ago

Thank you for your kind contribution. It is close to what I wanted, and very nice work. I installed the them into my blog without problems, and it loads. I find the Blog title gtes cut short, as does the page title, ut I am sur eI can solve that.

I cannot get the variant to work, and am not sur eif I am configuring correctly, although I tried a number of possibilities.

In my root conf.py I entered: GLOBAL_CONTEXT['HACK_VARIANT'] = 'dark'

WHich, upon build, threw the error:

GLOBAL_CONTEXT['HACK_VARIANT']= "dark" NameError: name 'GLOBAL_CONTEXT' is not defined

I also entered the same config line in congig.py in the themes/hack directory, which throws no errors and appears not to be read.

Could you guide me further please?

Thanks, John

Kwpolska commented 4 years ago

GLOBAL_CONTEXT is defined at the end of conf.py. You need to put GLOBAL_CONTEXT['HACK_VARIANT'] = 'dark' at the bottom, after GLOBAL_CONTEXT is defined.

There are no theme-specific config files.

plum commented 4 years ago

Thanks Kwpolska. I still don't get it. The instructions are not sufficient.

I have at line 1371 GLOBAL_CONTEXT = {} You say I must define it. How should I define it? I am supposed to enter functions, modules or data that I want available to templates. I tried, without success,

`GLOBAL_CONTENT= {HACK_VARIANT}

Then, below that you say I am supposed to enter: GLOBAL_CONTEXT['HACK_VARIANT'] = 'dark' Is that correct? It threw the same error.

Thanks for your attention, John

The instructions in Handbook for Global_Context do not help here. I prefer to get some clear instruction, please.

Kwpolska commented 4 years ago

It should look like this:

GLOBAL_CONTEXT = {}
GLOBAL_CONTEXT['HACK_VARIANT'] = 'dark'

Or like this:

GLOBAL_CONTEXT = {
    'HACK_VARIANT': 'dark',
}

For more details, refer to the Python tutorial.

plum commented 4 years ago

Ah yes, of course! I thought I had tried that! After your 1st tip. It works now. Many thanks for your kind help. Nikola is very very good. I used a similar engine called 'webber' for years, but alas it has dissapeared and is restricted to python2. I wanted to stick with a python engine that could serve documents and blogs.. and I have it now, after examining so many ... including the node.js kinds and Hugo. John