What does "|" do in {{ | }}?

For instance, what does “I” do in:

{{ .Date | dateFormat "January" }}

Is it an “OR” operator ?

It is a Go template pipe, used to stack actions one after another. See more details in this doc page:


@sjardim is right – and I suspect this is one of the more confusing points for new Hugo users. I think that syntax came from the veterans on the Go team that also are legends in the Unix community, Ken Thompson and Rob Pike. It has this very “unixy feel” to it, I think it looks reallt nice once you start chain many commands, e.g.:

{{ "my **string**" | emojify | markdownify | truncate }}

It also allows a streaming implementation in what we call Hugo Pipes:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.