Hugo partialCached
Executes the given template and caches the result, optionally passing context. If the contains a return statement, returns the given value, else returns the rendered output.
The partialCached function can offer significant performance gains for complex templates that don’t need to be re-rendered on every invocation.
Here is the simplest usage:
{{ partialCached "footer.html" . }}
Pass additional arguments to partialCached to create variants of the cached partial. For example, if you have a complex partial that should be identical when rendered for pages within the same section, use a variant based on section so that the partial is only rendered once per section:
{{ partialCached "footer.html" . .Section }}