Partial If Exists

Template to include the target partial if exists.

Donate

Become a backer or sponsor to support our work.

On this page

Sponsors

Parameters

Name

NameContextTypeRequiredDefaultSinceExample
Name-string---

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

Context

NameContextTypeRequiredDefaultSinceExample
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 */}}