Checking .Site.Params for customCSS always returns false

I have this in my config.toml:

[params]
  customCSS = "css/mine.css"
  subtitle = "..."
  ...

But the following condition always returns false:

{{ if isset .Site.Params "customCSS" }}
  <link rel="stylesheet" type="text/css" href="{{ .Site.BaseURL }}{{ .Site.Params.customCSS }}" />
{{ end }}

If I print out .Site.Params.customCSS, I see there is value that I specified in the config.toml.

I am not sure what I am missing here.

Thanks for helping me out of tunnel vision :frowning:

Use lower case with isset.

{{ if isset .Site.Params "customcss" }}

You can also just do:

{{ if site.Params.customCSS }}
  whatever
{{ end }}
2 Likes

Oh wow, really? I can understand accepting lowercase makes sense but not accepting the original case trips me. I like the second style. Going with that. Thank you.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.