Dive Into Fluid

This is a collection of examples and tutorials for the Fluid templating library.

Fluid is a C# implementation of Liquid, which was originally written by Shopify. There are multiple implementations for Liquid in different languages.

Most Liquid syntax works in Fluid. If something isn’t in this guide, but you can find it in other Liquid documentation, there’s a non-trivial chance it will work in Fluid.

I have tried to be clear about “Liquid” vs. “Fluid.” If something is specified as “Liquid,” then it will likely work in all implementations of the language. Something referenced as “Fluid” is just for this implementation.

I assumed no prior Liquid knowledge or functionality for this guide. For the code here, I pretended there was no Liquid doc; that Fluid was an original, standalone library; and I tested everything in “pure” Fluid (2.2.6, as of this writing)

No matter what the original Liquid doc says, what’s in this guide is gospel for Fluid. All code samples were executed in Fluid.

Also note that this is a guide mainly for C# developers. If you work with Liquid at the templating level, there’s a lot here for you as well, but this guide will dig down into the code under the implementation.

– Deane

Chapters still to be written:

Built-In Filter References

I originally stubbed out the following pages by reflecting the static classes in the Fluid.Filters namespace (v.2.2.7). All the filters below are automatically available in the default Fluid implementation, which the exception of the color filters.

As noted above, there is a lot of carryover from Liquid to Fluid, especially around filters. In fact, most filters were specifically tested against the original Liquid implementations, and some even had quirks built into them so they would behave the same and result in compatible, portable templates.

Remember, if you don’t find a filter you want, and you can develop in C#, writing your own filters is quite easy.