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> ...
source share