Jekyll - pass jekyll variable to user shortcut

I am trying to decide how to pass a Jekyll variable into a liquid tag plugin. I tried to do this:

{% liquidtag {{ variable }} %} 

But the variable is not implemented, and the tag simply gets the variable name with curly braces: {{ variable }}

It is also not implemented when I use: {% liquidtag {% variable %} %} - the {% before the variable is included in the string and %} after the variable is matched with the first {% liquid tag - last close %} ignored. Ie this passes: {% variable

I want the actual value of the variable to be passed to the tag.

Here is the tag:

 class CatAbs < Liquid::Tag def initialize(tag_name, text, tokens) super @text = text puts @text end def render(context) return @text.split("-").at(1) end end 

And here is how I now refer to the tag:

 {% for tag in site.categories %} <div class="grid grid-pad"> <a><h2>{% CatAbs {{ tag[0] }} %} Β»</h2></a> ... 
+5
source share
1 answer

After a lot of searching, I finally found the answer. I don’t know why it was so hard for me to find before! Sorry for the duplicate question! Here is the answer I found:

using fluid variables inside a fluid label call

+2
source

Source: https://habr.com/ru/post/1245425/


All Articles