Skip to content

Commit

Permalink
Use new BreadcrumbList Schema.org markup
Browse files Browse the repository at this point in the history
  • Loading branch information
rsiddle committed Oct 24, 2016
1 parent 856344b commit e33e30f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/app/helpers/spree/base_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def flash_messages(opts = {})
nil
end

def taxon_breadcrumbs(taxon, separator = " » ", breadcrumb_class = "inline")
return "" if current_page?("/") || taxon.nil?
def taxon_breadcrumbs(taxon, separator = ' » ', breadcrumb_class = 'inline')
return '' if current_page?('/') || taxon.nil?

crumbs = [[Spree.t(:home), spree.root_path]]

Expand All @@ -81,15 +81,15 @@ def taxon_breadcrumbs(taxon, separator = " » ", breadcrumb_class

separator = raw(separator)

crumbs.map! do |crumb|
content_tag(:li, itemscope: "itemscope", itemtype: "http://data-vocabulary.org/Breadcrumb") do
link_to(crumb.last, itemprop: "url") do
content_tag(:span, crumb.first, itemprop: "title")
items = crumbs.each_with_index.collect do |crumb, i|
content_tag(:li, itemprop: 'itemListElement', itemscope: '', itemtype: 'https://schema.org/ListItem') do
link_to(crumb.last, itemprop: 'item') do
content_tag(:span, crumb.first, itemprop: 'name') + tag('meta', { itemprop: 'position', content: (i+1).to_s }, false, false)
end + (crumb == crumbs.last ? '' : separator)
end
end

content_tag(:nav, content_tag(:ul, raw(crumbs.map(&:mb_chars).join), class: breadcrumb_class), id: 'breadcrumbs', class: 'sixteen columns')
content_tag(:nav, content_tag(:ol, raw(items.map(&:mb_chars).join), class: breadcrumb_class, itemscope: '', itemtype: 'https://schema.org/BreadcrumbList'), id: 'breadcrumbs', class: 'sixteen columns')
end

def taxons_tree(root_taxon, current_taxon, max_level = 1)
Expand Down

0 comments on commit e33e30f

Please sign in to comment.