Jan 01

October cms use curly brackets in twig markup

October cms is using twig as its templating language and in twig, you can access variables and other details using {{ }} double opening curly brackets and ending double curly brackets.

So, now if you want to add markup which is having word with double curly brackets it will simply not work directly in the markup. you need to escape curly brackets.

Fortunately, it's really easy. you just make your word in string so TWIG will treat it as a string and do not parse/interpolate it.

Check below example how to user string markup
<div id="id01">
{{ '{{firstName}} {{lastName}}' }} // <- HERE

var myObject = {"firstName" : "John", "lastName" : "Doe"};
w3.displayObject("id01", myObject);

{{ '{{firstName}} {{lastName}}' }} -> it will output {{firstName}} {{lastName}} in final html and you can show it or use it on your wensite