Class: Jekyll::SeoTag

Inherits:
Liquid::Tag show all
Defined in:
lib/jekyll-seo-tag.rb,
lib/jekyll-seo-tag/version.rb

Constant Summary collapse

MINIFY_REGEX =

Matches all whitespace that follows either

1. A '}', which closes a Liquid tag
2. A '{', which opens a JSON block
3. A '>' followed by a newline, which closes an XML tag or
4. A ',' followed by a newline, which ends a JSON line

We will strip all of this whitespace to minify the template We will not strip any whitespace if the next character is a ‘-’

so that we do not interfere with the HTML comment at the
very begining
%r!(?<=[{}]|[>,]\n)\s+(?\!-)!
VERSION =
"2.1.0".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_tag_name, text, _tokens) ⇒ SeoTag

Returns a new instance of SeoTag.



18
19
20
21
# File 'lib/jekyll-seo-tag.rb', line 18

def initialize(_tag_name, text, _tokens)
  super
  @text = text
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



5
6
7
# File 'lib/jekyll-seo-tag.rb', line 5

def context
  @context
end

Instance Method Details

#render(context) ⇒ Object



23
24
25
26
# File 'lib/jekyll-seo-tag.rb', line 23

def render(context)
  @context = context
  template.render!(payload, info)
end