Fix breadcrumbs (#1387)

This commit is contained in:
Dawa Ometto
2019-05-18 14:42:42 +02:00
committed by GitHub
parent 17c574467f
commit e28a41bb8f
2 changed files with 23 additions and 3 deletions
+3 -3
View File
@@ -26,14 +26,14 @@ module Precious
end
def breadcrumb
path = Pathname.new(@page.url_path_title)
path = Pathname.new(@page.url_path).parent
return '' if path.to_s == '.'
breadcrumb = []
path.descend do |crumb|
element = "#{crumb.basename}"
next if element == @page.title
breadcrumb << %{<a href="#{pages_path}/#{crumb}/">#{element}</a>}
end
breadcrumb.empty? ? "" : breadcrumb.join(" / ") << " /"
breadcrumb.join(' / ') << ' /'
end
def content