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,
lib/jekyll-seo-tag/image_drop.rb,
lib/jekyll-seo-tag/url_helper.rb,
lib/jekyll-seo-tag/author_drop.rb,
lib/jekyll-seo-tag/json_ld_drop.rb

Defined Under Namespace

Modules: JSONLD, UrlHelper Classes: AuthorDrop, Drop, Filters, ImageDrop, JSONLDDrop

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+(?\!-)!.freeze
VERSION =
"2.7.1"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_tag_name, text, _tokens) ⇒ SeoTag

Returns a new instance of SeoTag.



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

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

Instance Attribute Details

#contextObject

Returns the value of attribute context.



16
17
18
# File 'lib/jekyll-seo-tag.rb', line 16

def context
  @context
end

Class Method Details

.templateObject



73
74
75
# File 'lib/jekyll-seo-tag.rb', line 73

def template
  @template ||= Liquid::Template.parse template_contents
end

Instance Method Details

#render(context) ⇒ Object



34
35
36
37
# File 'lib/jekyll-seo-tag.rb', line 34

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