class BreadcrumbsOnRails::JsonLd::Builder
Public Instance Methods
render()
click to toggle source
# File lib/breadcrumbs_on_rails/json_ld/builder.rb, line 7 def render JSON.pretty_generate( "@context" => "http://schema.org", "@type" => "BreadcrumbList", "itemListElement" => @elements.map.with_index(1) { |elt, idx| render_element(elt, idx) }, ) end
Private Instance Methods
render_element(element, index)
click to toggle source
# File lib/breadcrumbs_on_rails/json_ld/builder.rb, line 18 def render_element(element, index) { "@type" => "ListItem", "position" => index, "item" => { "@id" => URI.join( URI.escape(@context.root_url), URI.escape(compute_path(element)), ).to_s, "name" => compute_name(element), }, } end