Hi, I created a small plugin:
module Jekyll
class RenderImgTag < Liquid::Tag
def initialize(tag_name, variables, tokens)
super
@variables = variables.split(" ", 2)
@url = @variables[0]
@alt = @variables[1]
end
def render(context)
"<img src='#{@url}' alt='#{@alt}' />"
end
end
end
Liquid::Template.register_tag('render_img', Jekyll::RenderImgTag)
Its mission:
{% render_img https://exampleimageurl.com "my alt text" %}
Its working great, but I need to include liquid variable. Like this:
{% render_img {{post.image.src}} "my alt text" %}
But its not working. How can I do that?