Class: Jekyll::StructuredContent::SchemaJsonLdTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::StructuredContent::SchemaJsonLdTag
- Defined in:
- lib/jekyll/structured_content/schema_json_ld_tag.rb
Instance Method Summary collapse
-
#initialize(tag_name, markup, tokens) ⇒ SchemaJsonLdTag
constructor
A new instance of SchemaJsonLdTag.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, markup, tokens) ⇒ SchemaJsonLdTag
Returns a new instance of SchemaJsonLdTag.
6 7 8 9 |
# File 'lib/jekyll/structured_content/schema_json_ld_tag.rb', line 6 def initialize(tag_name, markup, tokens) super @schema_kind = markup.to_s.strip end |
Instance Method Details
#render(context) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/jekyll/structured_content/schema_json_ld_tag.rb', line 11 def render(context) page = context.registers[:page] || {} site = context.registers[:site] data = build_schema(@schema_kind, page, site) return "" unless data data.to_json end |