{"id":"0d9267e59aed9de8","repo":"gohugoio/hugo","slug":"no-template-found-for-shortcode-q","errorCode":null,"errorMessage":"no template found for shortcode %q","messagePattern":"no template found for shortcode %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tpl/tplimpl/templatestore.go","lineNumber":695,"sourceCode":"\t\t\tisBetter := best.isBetter(weight, vv)\n\t\t\tif isBetter {\n\t\t\t\tbest.updateValues(weight, k2, k, vv)\n\t\t\t}\n\t\t}\n\n\t\treturn false, nil\n\t})\n\n\tif best.w.w1 <= 0 {\n\t\tvar err error\n\t\tif s := best.candidatesAsStringSlice(); s != nil {\n\t\t\tmsg := fmt.Sprintf(\"no compatible template found for shortcode %q in %s\", q.Name, s)\n\t\t\tif !q.Desc.IsPlainText {\n\t\t\t\tmsg += \"; note that to use plain text template shortcodes in HTML you need to use the shortcode {{% delimiter\"\n\t\t\t}\n\t\t\terr = errors.New(msg)\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"no template found for shortcode %q\", q.Name)\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn best.templ, nil\n}\n\n// PrintDebug is for testing/debugging only.\nfunc (s *TemplateStore) PrintDebug(prefix string, category Category, w io.Writer) {\n\tif w == nil {\n\t\tw = os.Stdout\n\t}\n\n\tprintOne := func(key string, vv *TemplInfo) {\n\t\tlevel := strings.Count(key, \"/\")\n\t\tif category != vv.category {\n\t\t\treturn\n\t\t}","sourceCodeStart":677,"sourceCodeEnd":713,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/tpl/tplimpl/templatestore.go#L677-L713","documentation":"When rendering `{{< name >}}` / `{{% name %}}` in content, Hugo's TemplateStore looks up a shortcode template by name across project, theme, and embedded templates. If no candidate template exists at all for that name, this error is returned (a sibling error, 'no compatible template found', fires when candidates exist but none match the output format/plain-text mode).","triggerScenarios":"Content using a shortcode `{{< foo >}}` when no `layouts/_shortcodes/foo.html` (or legacy `layouts/shortcodes/foo.html`) exists in the project, any mounted module, or the active theme, and it is not one of Hugo's embedded shortcodes.","commonSituations":"Typo in the shortcode name; theme not installed or module not mounted (missing `git submodule update` or `hugo mod get`); content copied from a site whose theme provided the shortcode; shortcode file placed in the wrong directory or with wrong extension for the output format.","solutions":["Check the spelling of the shortcode name in the content file against the filenames in layouts/_shortcodes/ (or the theme's).","Ensure the theme/module supplying the shortcode is actually installed and mounted (run `hugo mod graph` or verify the submodule is checked out).","Create the missing template, e.g. layouts/_shortcodes/<name>.html.","If the shortcode should output plain text (e.g. in RSS/plain formats), provide the matching variant such as <name>.txt."],"exampleFix":"<!-- content: {{< youtube-embed id >}} fails -->\n<!-- fix: create layouts/_shortcodes/youtube-embed.html -->\n<div class=\"video\">{{ .Get 0 }}</div>","handlingStrategy":"validation","validationCode":"# verify the shortcode file exists before using it in content\nls layouts/_shortcodes/myshortcode.html","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create layouts/_shortcodes/<name>.html (or verify the theme provides it) before using {{< name >}} in content","Match the shortcode name in content exactly to the template filename (case-sensitive)","When switching or updating themes, grep content for shortcode usages and confirm each still has a template","Use `hugo --printPathWarnings` and a CI build to catch missing shortcodes before deploy"],"tags":["hugo","shortcodes","templates","themes"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}