Build a theme system that lets non-developers customize web page layouts without risking server security.
Create an email templating system where end users personalize content using their own variables and filters.
Render HTML safely from database-stored templates in a multi-tenant SaaS app.
Add separate template environments for different contexts like storefronts versus transactional emails.
Liquid is an open-source template engine created by Shopify, written in Ruby. It was built to let users customize the appearance of web applications by editing templates, without allowing those users to run arbitrary code on the server. This makes it suitable for situations where template files come from end users or are stored in a database, rather than being written by trusted developers. The key design goal is safety. Liquid templates can output variables, loop over lists, apply conditional logic, and use filters to format values, but they cannot call arbitrary Ruby methods or execute server-side code. The engine is also stateless: parsing a template and rendering it are two separate steps, so a template can be compiled once and then rendered many times with different data, which makes repeated use efficient. The syntax uses double curly braces for output (for example, a product name or price) and curly brace percent signs for logic (such as loops and conditionals). This style will be familiar to anyone who has used Shopify themes or other template languages like Twig or Jinja. A feature called Environments lets developers register different sets of custom tags and filters for different contexts, for example separate configurations for storefront pages versus email templates. This keeps customizations isolated and prevents them from interfering with each other. The parser also supports different error modes, ranging from fully lenient (the default, which accepts almost anything) to strict (which raises errors for invalid syntax), which is useful when building template editors where users should see clear feedback. Liquid is the engine behind Shopify themes and is used in several other projects that need safe, user-editable templates.
← shopify on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.