How do i use variables as text and not as variables on my site?

Hi folks :slight_smile:

I wanna make a small how-to site about jekyll. Therefore I use very often the keywords {{ content }} or {{ page.somevariable }}

The problem is that in that very moment I am using these keywords, I have a blank output (as jekyll renders them as variables)

Example:


layout: page
permalink: /test/

Type in {{ page.somevariable }}

The outcome of my page is of course:

Type in
(As the variable is not defined and jekyll tries to render the site with the variable)

So how do I can make a jekyll how-to site without having weird output ?

Thx in advance

1 Like

Nice, this is a good idea.

OK - I got the solution

To make the left and right brackets you have to use following html-codes:
left-curly-bracket: & # 1 2 3 ;
right-curly-bracket: & # 1 2 5;
WITHOUT the spaces !
So the text needs to be:

Type in & # 1 2 3 ; & # 1 2 3 ; page.somevariable & # 1 2 5 ; & # 1 2 5 ; (Witout the spaces)
This will then output:
Type in {{ page.somevariable }}

This is now just for reference if somebody has the same problem.

Hope this help

this is what the {% raw %} {% endraw %} tag is for.

Jekyll processes all Liquid filters in code blocks

If you are using a language that contains curly braces, you will likely need to place {% raw %} and {% endraw %} tags around your code. Since Jekyll 4.0 , you can add render_with_liquid: false in your front matter to disable Liquid entirely for a particular document.

1 Like

Gr8 - Works like charm - Thank you :slight_smile: