Skip to content

Instantly share code, notes, and snippets.

@protometa
Last active January 4, 2016 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save protometa/8658048 to your computer and use it in GitHub Desktop.
Save protometa/8658048 to your computer and use it in GitHub Desktop.
DocPad Jade Bootstrap Breadcrumbs Mixin
mixin crumbs
ol.breadcrumb
li: a(href="/") Home
- var url = document.url.split("/").slice(1)
each dir, index in url
- var doc = getCollection("html").findOne({ url: "/"+url.slice(0,index+1).join("/") })
if url.length - index == 1
li(class= "active" )= doc ? doc.toJSON().title : dir
else
if doc
li: a(href= "/"+url.slice(0,index+1).join("/") )= doc.toJSON().title
else
li(class= "active" )= dir
@protometa
Copy link
Author

Now uses document titles for links. If no index exists at a directory, it is listed without a link. Requires https://github.com/docpad/docpad-plugin-cleanurls. Not for use on the home page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment