{"record":{"id":"cd8d67770a5be1d9","repo":"gohugoio/hugo","slug":"s-shortcode-q-does-not-evaluate-inner-or-inne","errorCode":null,"errorMessage":"%s: shortcode %q does not evaluate .Inner or .InnerDeindent, yet a closing tag was provided","messagePattern":"(.+?): shortcode %q does not evaluate \\.Inner or \\.InnerDeindent, yet a closing tag was provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/shortcode.go","lineNumber":650,"sourceCode":"\t\t\t\tif !sc.templ.ParseInfo.IsInner {\n\t\t\t\t\treturn sc, nil\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase currItem.IsShortcodeClose():\n\t\t\tclosed = true\n\t\t\tnext := pt.Peek()\n\t\t\tif !sc.isInline {\n\t\t\t\tif !sc.needsInner() {\n\t\t\t\t\tif next.IsError() {\n\t\t\t\t\t\t// return that error, more specific\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tname := sc.name\n\t\t\t\t\tif name == \"\" {\n\t\t\t\t\t\tname = next.ValStr(source)\n\t\t\t\t\t}\n\t\t\t\t\treturn nil, fmt.Errorf(\"%s: shortcode %q does not evaluate .Inner or .InnerDeindent, yet a closing tag was provided\", errorPrefix, name)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif next.IsRightShortcodeDelim() {\n\t\t\t\t// self-closing\n\t\t\t\tpt.Consume(1)\n\t\t\t} else {\n\t\t\t\tsc.isClosing = true\n\t\t\t\tpt.Consume(2)\n\t\t\t}\n\t\t\treturn sc, nil\n\t\tcase currItem.IsText():\n\t\t\tsc.inner = append(sc.inner, currItem.ValStr(source))\n\t\tcase currItem.IsShortcodeName():\n\n\t\t\tsc.name = currItem.ValStr(source)\n\n\t\t\t// Used to check if the template expects inner content,\n\t\t\t// so just pick one arbitrarily with the same name.","sourceCodeStart":632,"sourceCodeEnd":668,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/shortcode.go#L632-L668","documentation":"Raised in extractShortcode (shortcode.go:650) when a closing shortcode tag ({{< /name >}}) is encountered but the resolved shortcode template's ParseInfo.IsInner is false — meaning the template never reads .Inner or .InnerDeindent. Hugo treats closing tags as meaningful only for shortcodes that consume inner content; supplying one for a non-inner shortcode is an error.","triggerScenarios":"Writing {{< highlight go >}}...{{< /highlight >}} is correct (highlight uses .Inner), but writing {{< figure src=\"x.png\" >}}...{{< /figure >}} fails because figure does not use .Inner; closing a self-closing shortcode by habit; mismatched names where the opening tag resolved to a non-inner template.","commonSituations":"Habitually closing all shortcodes; using a closing tag on shortcodes ported from another system that required them; template changes that removed .Inner usage without updating content.","solutions":["Remove the closing tag for shortcodes whose templates do not use .Inner (use the self-closing form {{< name ... >}}).","If inner content is intended, update the shortcode template to evaluate .Inner or .InnerDeindent.","Check for typos in the closing tag name that resolve to a different (non-inner) shortcode."],"exampleFix":"{{/* before: figure does not use .Inner */}}\n{{< figure src=\"x.png\" >}}caption{{< /figure >}}\n\n{{/* after */}}\n{{< figure src=\"x.png\" >}}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only close shortcodes whose templates evaluate .Inner or .InnerDeindent.","Use the self-closing form {{< name ... >}} for non-inner shortcodes (figure, ref, etc.).","When authoring a shortcode template, decide upfront whether it consumes .Inner and document it."],"tags":["shortcode","templates","content"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}