module Jekyll
class ImageTag < Liquid::Tag
def initialize(tag_name, parameters, tokens)
super
@params = {}
parameters.scan(/(\w+)\s*=\s*"([^"]+)"/) do |key, value|
@params[key] = value
end
end
def render(context)
environment = ENV['JEKYLL_ENV'] || 'development'
url = @params['url']
alt = @params['alt'] || "Link to image"
if environment == 'ipfs'
"#{alt}"
elsif alt
""
else
""
end
end
Liquid::Template.register_tag('image', self)
end
end