Skip to content

Instantly share code, notes, and snippets.

@LightGuard
Created November 22, 2013 19:42
Show Gist options
  • Save LightGuard/7605639 to your computer and use it in GitHub Desktop.
Save LightGuard/7605639 to your computer and use it in GitHub Desktop.
Trying to fix the breadcrumb helper
diff --git a/_ext/breadcrumb.rb b/_ext/breadcrumb.rb
index 410c2dd..71dc4e5 100644
--- a/_ext/breadcrumb.rb
+++ b/_ext/breadcrumb.rb
@@ -56,13 +56,11 @@ module Awestruct
def findInPages(path)
-
- for page in site.pages
- if page.output_path.eql?(path)
- return page
- end
+ if site.page_map.nil?
+ site.send("page_map=", Hash[site.pages.map { |p| [p.output_path, p]}.flatten.each_slice(2).to_a])
end
- nil
+
+ site.page_map[path]
end
def generateAnchorHtml( page , isLast )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment