Liquid Parser in Text-based Files
Liquid markup is a powerful way to render dynamic content and is a fundamental part of the WebinOne platform, which is why Liquid can be parsed in all supported text-based files, not just HTML.
By default, Liquid markup can be readily used throughout many parts of the admin, within Templates, Pages, Notifications and system properties. Typically, these are parsed and output to HTML files on your website.
However, Liquid logic and rendering (including Component tags) can also be parsed in other text-based files served from your WebinOne’s website instance, such as in files of type .css, .js, .xml, .json, .svg, .txt and more.
This provides a wide range of powerful customisation options and development opportunities when working with the WebinOne platform and your CMS content and custom logic.
Enable Liquid Parsing
To enable Liquid parsing in text-based files, other than HTML, simply serve the file by referencing the liquid=1
parameter in its source URL, for example:
<link rel="stylesheet" href="/css/style.css?liquid=1">
Or, if referencing a file in the browser or an external system:
https://mydomain.com/assets/shop-feed.xml?liquid=1
Always include a URL parameter with a ?
character. Or if URL parameters are already in use in your file path, add additional parameters with an &
character, eg:
https://mydomain.com/assets/shop-feed.xml?catalog=electronic&liquid=1
Use Cases
Some use cases might be as follows, but not limited to:
- Dynamic CSS and JS files - to configure colours and other variables, or to include/omit relevant CSS/JS for the given condition/s, or to set variables directly in JS instead of relying on DOM traversing at load time.
It could even be used to concatenate multiple files into one via the use of an include component or the File System API component. - Feeds for external systems - such as RSS, XML, JSON, KML, CSV, etc. for automatic Google Shopping feeds, syndication of news/updates, or custom reporting/export of data.
- Configuration files - for use locally, or externally, for a plugin or your own custom project/module.