Hugo Template Issue (prints <no value>)

Hey Folks!

I’m trying to create a new theme. It was going awesome until this issue came up. Whenever I try to put {{ .Site.BaseURL }} in any CSS file, it renders “< no value >” in the place (without quotes). Moreover, the CSS in which I use {{ $variable.UniqueID }}, are not even rendered at all.

Summing things up; Hugo not rendering .Site.BaseURL, and CSS with $p.UniqueID.

I think this might arise from a previous issue in the where I have defined block as:
{{ block “title” . }}
{{ .Site.Title}}
{{ end }}

In my single.html file, I have redefined title to replace it with:
{{ define “title”}}
{{ .Title }} – {{ .Site.Title }}
{{ end }}

(The – above is actually &ndash) And the title can be printed anywhere except on the browser tab where it should be. Neither Site title nor page title. Just: localhost:xxxx/pageName shows up on the browser tab.

Another thing to note is that whenever I use printf function, it renders the correct title & sitebaseURL value (with no other content of course).

Neither the site title nor the page title shows up. I am attaching some pictures if that can help.

Baseof.html Code

Head.html Code


CSS Code

Final Result

One thing is obvious… From partial templates docs:

One of the most common mistakes with new Hugo users is failing to pass a context to the partial call. In the pattern above, note how “the dot” (.) is required as the second argument to give the partial context. You can read more about “the dot” in the Hugo templating introduction.

Also see by @regis.

I figured out the solution. The {{ partial “head.html” }} in the baseof.html required its dot ‘.’. In case anybody else gets into this issue, the replace the partial call with: {{ partial “blahblah.html” . }}