Partial If Exists

Template to include the target partial if exists.

Parameters

Name

NameContextTypeRequiredDefaultSince
Name-string--

The target partial name, extension is required, such as foo.html.

Context

NameContextTypeRequiredDefaultSince
Context-any--

The context passed to target partial.

Usage

1{{ partial "base/partial-if-exists" (dict "Name" "foo.html" "Context" "bar") }}
1// layouts/partials/foo.html
2Value: {{ . }} {{/* Value: bar */}}