eleventy

What is the difference between the {{ xyz}} and {% abc %} template tags in eleventy?


I have seen both {{ this }} and {% that %}} tags in the eleventy .md files. I've noticed that filters (functions) work with the double curly brackets and the {% work shortcodes. Is that the only difference or is there something more fundamental?


Solution

  • {{ XYZ }}
    

    is Liquid templating. Other languages are also supported, such as

    So, there is a fundamental difference between {{ XYZ }} and {% ABC %}, that is, they are referring to different template engines.

    EDIT

    Found a further key information

    Tags create the logic and control flow for templates. The curly brace percentage delimiters {% and %} and the text that they surround do not produce any visible output when the template is rendered. This lets you assign variables and create conditions or loops without showing any of the Liquid logic on the page.

    enter image description here

    https://shopify.github.io/liquid/basics/introduction/

    So, it turns out that the {{ ... }} syntax is for text output, while the {% ... %} syntax is for logical computing.

    Further information: https://mozilla.github.io/nunjucks/templating.html