Class: Jekyll::SeoTag

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

Defined Under Namespace

Modules: JSONLD Classes: Drop, Filters

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.2.3".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_tag_name, text, _tokens) ⇒ SeoTag

Returns a new instance of SeoTag.



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

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

Instance Attribute Details

#contextObject

Returns the value of attribute context.



10
11
12
# File 'lib/jekyll-seo-tag.rb', line 10

def context
  @context
end

Instance Method Details

#render(context) ⇒ Object



28
29
30
31
# File 'lib/jekyll-seo-tag.rb', line 28

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