Skip to content

file.Block

Block returns the contents of a given block

go
## <<Stencil::Block(name)>>
Hello, world!
## <</Stencil::Block>>

## <<Stencil::Block(name)>>
{{- /* Only output if the block is set */}}
{{- if not (empty (file.Block "name")) }}
{{ file.Block "name" }}
{{- end }}
## <</Stencil::Block>>

## <<Stencil::Block(name)>>
{{- /* Short hand syntax. Adds newline if no contents */}}
{{ file.Block "name" }}
## <</Stencil::Block>>