Module: SolidusSeo::Jsonld::TagHelper

Defined in:
lib/solidus_seo/jsonld/tag_helper.rb

Instance Method Summary collapse

Instance Method Details

#captured_jsonldObject



26
27
28
29
# File 'lib/solidus_seo/jsonld/tag_helper.rb', line 26

def captured_jsonld
  @captured_jsonld ||= {}
  @captured_jsonld.values.join("\n").html_safe
end

#dump_jsonldObject



31
32
33
# File 'lib/solidus_seo/jsonld/tag_helper.rb', line 31

def dump_jsonld
  captured_jsonld + jsonld(current_store)
end

#jsonld(item, opts = {}) ⇒ String

Returns Retrieves jsonld tag markup.

Parameters:

  • item (Object)

    A jsonld hash or any object that implements ‘to_jsonld` method

  • opts (:exclude) (defaults to: {})
    Array

    Blacklist of attributes from jsonld

  • opts (:only) (defaults to: {})
    Array

    Whitelist of attributes from jsonld

  • opts (:force) (defaults to: {})
    Boolean

    Force cache miss

Returns:

  • (String)

    Retrieves jsonld tag markup.



14
15
16
# File 'lib/solidus_seo/jsonld/tag_helper.rb', line 14

def jsonld(item, opts = {})
  jsonld_fetch(:base, item, opts.symbolize_keys)
end

#jsonld_breadcrumbs(breadcrumbs) ⇒ Object



22
23
24
# File 'lib/solidus_seo/jsonld/tag_helper.rb', line 22

def jsonld_breadcrumbs(breadcrumbs)
  jsonld_fetch(:breadcrumbs, breadcrumbs)
end

#jsonld_list(collection) ⇒ Object



18
19
20
# File 'lib/solidus_seo/jsonld/tag_helper.rb', line 18

def jsonld_list(collection)
  capture_jsonld(:list, jsonld_fetch(:list, collection))
end