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
|
|
|
|
|
2011-02-18 23:51:57 +00:00
|
|
|
# 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
|