engine/lib/locomotive/liquid/tags/seo_metadata.rb

23 lines
624 B
Ruby
Raw Normal View History

2011-02-13 13:40:55 +00:00
module Locomotive
module Liquid
module Tags
class SEOMetadata < ::Liquid::Tag
def render(context)
%{
<meta name="description" content="#{sanitized_string(context.registers[:site].meta_description)}" />
<meta name="keywords" content="#{sanitized_string(context.registers[:site].meta_keywords)}" />
}
end
# Removes whitespace and quote charactets from the input
2011-02-13 13:40:55 +00:00
def sanitized_string(string)
string.strip.gsub(/"/, '')
end
end
::Liquid::Template.register_tag('seo_metadata', SEOMetadata)
end
end
end