Error calling partial: partial "partial/defaultFigure" not found

You can do that, but there’s no need to…

layouts/_default/home.html

{{ partial "foo.html" . }}

layouts/partials/foo.html

{{ partial "bar.html" . }}

{{ define "partials/bar.html" }}
  {{ return "baz" }}
{{ end }}

Notes:

  1. Always include the .html suffix when calling or defining the partial
  2. Partials defined inline, as shown above, are globally available. That means there can be name collisions with templates in the partials directory, and with other inline partials. So, you might want to do something like this instead:

layouts/partials/foo.html

{{ partial "inline/foo/bar.html". }}

{{ define "partials/inline/foo/bar.html" }}
  {{ return "baz" }}
{{ end }}
1 Like