talira

Safe, customer facing template language for flexible web apps

open sourceMITself-hostablefree

Liquid is Shopify's template language, written so that users can edit templates without being able to run code on the server: it never evaluates Ruby, and templates see only the variables and filters you give them. Templates use {{ }} for output with filters and {% %} for tags such as loops and conditions, and parsing is separate from rendering, so a template is compiled once and rendered many times. It works for HTML and emails alike, and apps add their own filters and tags.

Problems it solves

  • let customers edit their own email or page templates without running code on our server
  • a safe template language for templates stored in the database
  • render user-written templates in Ruby with loops and conditions but no access to our objects
  • ERB is too dangerous to let customers write
  • parse a template once and render it thousands of times with different data
  • add our own filters for formatting dates and money in customer templates
  • the same template syntax for HTML pages and emails
  • Shopify-style templates in a Rails app

Features

  • no code evaluation
  • output with filters
  • tags for loops, conditions and assignments
  • separate parse and render
  • custom filters and tags
  • error modes from lax (the default) to strict2

Capabilities

Takes pluginsplan not known

Alternatives

The same job

These do what Liquid does.

  1. LiquidJS A simple, expressive, safe and Shopify compatible template engine in pure JavaScript
  2. Jinja A very fast and expressive template engine
  3. Haml HTML templating engine for Ruby with indentation-based, end-tag-free markup

Compare Liquid with the top 3