Template to include the target partial if exists.
Become a backer or sponsor to support our work.
Name
Name | Context | Type | Required | Default | Since | Example |
---|---|---|---|---|---|---|
Name | - | string | ✓ | - | - | - |
The target partial name, extension is required, such as foo.html
.
Context
Name | Context | Type | Required | Default | Since | Example |
---|---|---|---|---|---|---|
Context | - | any | ✓ | - | - | - |
The context passed to target partial.
1{{ partial "base/partial-if-exists" (dict "Name" "foo.html" "Context" "bar") }}
1// layouts/partials/foo.html
2Value: {{ . }} {{/* Value: bar */}}