Highlight liquid code in Jekyll blog post

Project: codepediaorg.github.io

You need to place and 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. Use the standard Code snippet highlighting from Jekyll:


<figure class="highlight"><pre><code class="language-liquid" data-lang="liquid">      <span class="p">{%</span><span class="w"> </span><span class="kr">if</span><span class="w"> </span><span class="nv">page</span><span class="p">.</span><span class="nv">categories</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="s2">"snippets"</span><span class="w"> </span><span class="p">%}</span>
        <span class="p">{%</span><span class="w"> </span><span class="nt">include</span><span class="w"> </span>promote-bookmarks.dev.html<span class="w"> </span><span class="p">%}</span>
      <span class="p">{%</span><span class="w"> </span><span class="kr">endif</span><span class="w"> </span><span class="p">%}</span></code></pre></figure>

Or place it in markdown code markers:

```liquid

  {% if page.categories[0] != "snippets" %}
    {% include promote-bookmarks.dev.html %}
  {% endif %}

```

Reference - https://jekyllrb.com/docs/liquid/tags/


Shared with from Codever.land. 👉 Use the Copy to mine functionality to copy this snippet to your own personal collection and easy manage your code snippets.

Subscribe to our newsletter for more code resources and news

Adrian Matei

Adrian Matei
Life force expressing itself as a coding capable human being

How to get current time in java enterprise and be easily testable

How to get current time in java enterprise and be easily testable code snippet Continue reading