Introducing DotLiquid: the secure, open-source template engine for .NET
Want to skip straight to the goods?
One of the questions that comes up fairly often for the average developer is: "How can I transfer this data into that output?" The data often takes the form of an object, and the output is often HTML or plain text. There are, of course, many ways of skinning the cat1.
These existing .NET template engines are very suitable for one specific use-case: when the developer, or another trusted party, is responsible for authoring the templates. However, to the best of my knowledge, there have not been any full-featured2 template engines available for .NET which are suitable for the other use-case: when you want customers to edit their own templates. You may want this because you host the customer's website on your server, or simply because .NET is too complex to give to a non-techie.
- It is secure. It only allows access to the data and operations you explicitly allow.
- It is proven. The Liquid template language has been used in major web applications such as Shopify.
- It can be extended easily, in part because it is open source, in part because it's designed that way.
- It is completely standalone.
Where can I find it?
The website is here. You can try it online. The source code for DotLiquid is hosted on GitHub, and can be found here. This is also the place to log issues. There is some documentation, although (as ever) I hope to expand on what is there. The current version of DotLiquid can be downloaded here (we're on Beta 2 at the moment, and we're just letting that brew for a while before pushing out the final release of 1.0). Once "the package manager formerly known as NuPack" has settled down a bit, I'll be creating a package so that you can easily include DotLiquid in your projects.
If you've made it this far, chances are you might be looking for this sort of library. If you do use it in your project, I hope you find it helpful, and if you would like your project to be mentioned on the DotLiquid website, just drop me a line.
DotLiquid wouldn't exist without Liquid, and Liquid wouldn't exist without Tobias Lütke. Thank you Tobias.
I'd also like to thank Alessandro Petrelli for his many useful contributions to DotLiquid.
comments powered by Disqus