Template:
<script {{ if true }} type="" {{ end }}></script>
Error:
render of "page" failed:
"/Users/Will/Developer/paige/layouts/_default/baseof.html:33:11":
execute of template failed at <partial "paige/scripts.html" $page>:
error calling partial:
"/Users/Will/Developer/paige/layouts/partials/paige/scripts.html:34:3":
execute of template failed at <partial "paige/script.html" (dict "src" "_paige/bootstrap/bootstrap.bundle.js")>:
execute of template failed:
html/template:partials/paige/script.html:1:14:
{{if}} branches end in different contexts:
{stateTag delimNone urlPartNone jsCtxRegexp attrNone elementNone <nil>},
{stateTag delimNone urlPartNone jsCtxRegexp attrNone elementScript <nil>}
render of "home" failed:
{stateTag delimNone urlPartNone jsCtxRegexp attrNone elementNone <nil>},
{stateTag delimNone urlPartNone jsCtxRegexp attrNone elementScript <nil>}
failed to render pages:
{stateTag delimNone urlPartNone jsCtxRegexp attrNone elementNone <nil>},
{stateTag delimNone urlPartNone jsCtxRegexp attrNone elementScript <nil>}
If you remove the condition around the type attribute, or rename type to something else, then there’s no error.
Env:
❯ hugo env
hugo v0.111.3+extended darwin/amd64 BuildDate=unknown
GOOS="darwin"
GOARCH="amd64"
GOVERSION="go1.20.2"
github.com/sass/libsass="3.6.5"
github.com/webmproject/libwebp="v1.2.4"
github.com/sass/dart-sass-embedded/protocol="1.2.0"
github.com/sass/dart-sass-embedded/compiler="1.59.2"
github.com/sass/dart-sass-embedded/implementation="1.59.2"
If you want to repro it yourself, replace the content of paige/script.html at b381f8742d2be6b39c44713a8c0d303cfca864a8 · willfaught/paige · GitHub with the above template.