I have the following partial:
<div class="tab-bar">
<nav class="tab-bar-nav" role="navigation">
<ul>
{{ $mycurrentPage := . }}
<li class="{{if .IsHome }}active{{end}}">
<a href="/">
<span class="menu-icon">{{ partial "icons/icon-home.html" . }}</span>
<span>Home</span>
</a>
</li>
{{ range .Site.Menus.main }}
{{ $icon := .Pre }}
{{ $path := (printf "%s%s" "icons/" $icon) }}
<li class="{{if or ($mycurrentPage.IsMenuCurrent "main" .) ($mycurrentPage.HasMenuCurrent "main" .) }}active{{end}}">
<a href="{{.URL}}">
<span class="menu-icon">{{ partial $path . }}</span>
<span>{{ .Name }}</span>
</a>
</li>
{{ end }}
</ul>
</nav>
</div>
This rendered fine earlier today. I haven’t changed anything. Now I get:
ERROR 2018/08/26 21:38:43 Error while rendering "section" in "about/": template: _default/list.html:27:36: executing "mobile-nav" at <partial "site/mobile...>: error calling partial: template: partials/site/mobile-nav.html:17:37: executing "p
artials/site/mobile-nav.html" at <partial $path .>: error calling partial: Partial "icons/" not found
If I put a space in there: "%s %s"
I get something closer to a path (but with a space, as expected):
... at <partial $path .>: error calling partial: Partial "icons/ icon-blog.html" not found
I don’t understand how printf
could stop evaluating a string concatenation when it worked earlier. I’ve restarted computer/server etc. to troubleshoot.