[Solved] How do I use custom params? I'm dying

Windows 10 - config.toml:

title = "TITLES!"

disqusShortname = "auniquenameblog"
author = "Bananas"
disqus = "red"
one = "onfew"

Using the disqus.html partial, I see a:
{{ with .Site.Params.disqus }}
and have tried it as:
{{ with .Site.Params.disqusShortname }}

The disqus code is included in my output if I do:
{{ with .Site.Params.Author }}
as well as:
{{ with .Site.Params.author }}

Additionally, the disqus code is NOT included if I do
{{ with .Site.Params.one }}
{{ with .Site.Params.disqus }}

My understanding is that I must place custom stuff within the [param]. Yet, this yields no output ever:
{{ $.Site.Params.one }}

I should add that this is with the blackburn theme and here is the complete disqus.html file (as it came originally):

{{ with .Site.Params.disqus }}
<div id="disqus_thread"></div>
<script type="text/javascript">

(function() {
    // Don't ever inject Disqus on localhost--it creates unwanted
    // discussions from 'localhost:1313' on your Disqus account...
    if (window.location.hostname == "localhost")

    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
    var disqus_shortname = '{{ . }}';
    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com/" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
{{ end }}

I should also add, here’s my question:

Why isn’t the {{ with .Site.Params.one }} working? and why doesn’t {{ $.Site.Params.one }} return its value on my output? Lastly, is there any special handing of disqus that may be messing me up that I’m not aware of?

Wild guesses, sorry:

  • try adding 3 or 4 spaces in front of each param?
  • try [params] vs [Params]

Can you share the full config file, and even better, the full site repo?

On one site of mine (which probably won’t even compile with the latest hugo!) I use disqus but, I put the disqus param at the root of the config, and it “just works” from there:

I’m not calling it specifically, just calling the built in shortcode like:

The conditional is checking the existence of frontmatter hidecomments, in pages such as this:


Since no one has said, “wtf are you doing?!”, I’m going to assume that this should be working… if everything is right. Thanks for the tips. Will post more fuller config file if I still can’t get it.

Oh no. My config.toml is from an old directory of the site. Not my current one. FML FML FMLMFLFMLFMLFMLF. Sec, I bet it’ll work.

Yup, everything working fine now. {{ with .Site.Params.one }} works great.

{{ with .Site.Params.Author }}
{{ $.Site.Params.Author }}
{{ $.File.BaseFileName }}

Everything working great. Great GReAT GREATTTT!

I’m an idiot and am ashamed.

1 Like