How to use `pygmentsUseClasses` in HTML?


#1

I am using Pygments to load an external CSS and an planning to create and if case to load the CSS only when pygmentsUseClasses is true. But when I try to access it using {{ .Site.PygmentsUseClasses }}, Hugo CLI throws off an error saying it can’t evaluate it. Is it not a site variable. How to access it?


#2

That variable is not available from the templates.

I guess the workaround is to add your own variable to manually mirror that…

In config:

[Params]
  pygments_css = true

And then use it as .Site.Params.pygments_css.