I try to include partial to a single page template via dynamic path. I do the following:
{{ $a := "partials/synopsis/" }}
{{ $b := .Params.id }}
{{ $c := ".html" }}
{{ $address := printf "%s" $c | printf "%s%s" $b | printf "%s%s" $a | printf "%s" }}
{{ print $address }}
That prints the correct path “partials/synopsis/0548.html” on my page.
But when i add this:
{{ partial $address . }}
Hugo shows an error.
render of "page" failed: "/Users/ivanzolotov/Desktop/playground/layouts/_default/single.html:20:9": execute of template failed at <partial ($address) .>: error calling partial: partial "partials/synopsis/.html" not found render of "page" failed: partial "partials/synopsis/.html" not found failed to render pages: partial "partials/synopsis/.html" not found
I cant understand why $address
variable is ’loosing’ .Params.id
part of my path. Can you please help me?