Security restriction for partials?

Set disqusShortname = 'whatever' in hugo.toml, and define the partial partials/show-disqus-shortname.html that contains:

<h1>{{ .Site.DisqusShortname }}</h1>

Now insert the following into layouts/_default/baseof.html, main secton:

<h1>{{ .Site.DisqusShortname }}</h1><br>
<h1>{{ partial "show-disqus-shortname" }}</h1>

The shortname is shown once, by the first line. There is no output from the second, as if
.Site.DisqusShortname is not defined in that context.

Is this some kind of security measure? Is there a work-around?

This question is motivated by the preference to enter disqusShortname in only one place, the
global configuration file, and not in partials that are used to display comment counts, for example.
Of course, having to enter it in one more place is not a big problem.

You are not passing any context to the partial.

1 Like

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