Liquid Variables | Table O Contents

Variables in Liquid are declared at the Yaml front matter section of the page …

Note. The Flammarion Logo Badge in the page header above is an .svg image file set to the dimensions of 5% width, auto height, and zoom. Go ahead and test the zoom-out feature by hovering over the badge to engage the expansion of the image.

First Subtitle

Hint. Place the intro paragraph ie.) the ‘hypothesis’ here …

More to come …

Importing Variables

By placing a variable in the yaml front matter of your page …

That variable can then be used multiple times throughout the content of your page.

Liquid Comments

How to craft a Liquid comment statement in Jekyll …

Simple Comment

In a simple Liquid Comment statement in Jekyll place your text between the comment and the endcomment tags, as follows:

{% comment %}
Developer notes go inside ...
{% endcomment %}

For example, here is a Liquid comment tag that takes advantage of the now available variable placement.

As follows,

{% comment %}version{% endcomment %}

Note. When the page is rendered, the value stored inside the variable version, in this case a String

Becomes applied within the enclosing Liquid tag.

The variable namespace version is actually pointing to the location within the page memory stack where the data of the String type value is stored.

The value of the namespace version is then output to the screen.

As follows live


What happened?

Where is the comment?

Answer: When using a Liquid comment tag to define a page comment …

The comment tag is placed on the page for the benefit of the developer.

Not the end-user.

You can see this in the source view of the page by clicking view, developer, view source from the main menu of your Chrome browser window.

Zip, zero, nada.

The program pulls the contents of the String value from the declared yaml front matter variable, places the value within the Liquid comment statement, and displays nothing.

Not even in the source of the page!

Complex Comment

In a complex Liquid Comment statement in Jekyll place your text and/or code between the comment and the endcomment tags, as well.

As follows:

{% comment %}
{% endcomment %}

Note. When rendering complex comments in Markdown each and every Liquid statement within must be enveloped in a set of raw Liquid tags to avoid execution, as follows:

{% comment %}
{:hello ... this is an example of a Liquid tag.
But, you cannot execute me ...
Because I am enveloped within a set of {% raw - endraw %} liquid tags.}
{% endcomment %}

Note. The set of comment - endcomment Liquid tags will hide the text from the end-user as a comment, but any code statements will not be hidden from the Liquid compiler in Jekyll.

Hence, when rendering a complex Liquid Comment statement in Jekyll, wrap your set of comment - endcomment Liquid tags inside a set of raw - endraw Liquid tags, too.

Last Subtitle

More to come …

Note. The above synopsis was derived from an article written by Blank Author [1].

  1. A Narrative of Psychology by Blank Author, Jan #1999


Please support the co-workers who aggregate the Source Links for our projects.


Like what you see in this project? If so, then support the authors and machine-elves who aggregate the source links and pages for our projects via Patreon.