5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/nanoc/helpers/breadcrumbs.rb', line 5
def breadcrumbs_trail
components = item.identifier.components
prefixes = components.inject(['']) { |acc, elem| acc + [acc.last + '/' + elem] }
if @item.identifier.legacy?
prefixes.map { |pr| @items[Nanoc::Identifier.new('/' + pr, type: :legacy)] }
else
prefixes
.reject { |pr| pr =~ /^\/index\./ }
.map do |pr|
if pr == ''
@items['/index.*']
else
@items[Nanoc::Identifier.new(pr).without_ext + '.*']
end
end
end
end
|