From a3d251a18eb38f169585d6ccff254f793a97713e Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Fri, 11 Mar 2016 15:54:16 -0500 Subject: [PATCH] Improve breadcrumb helper - Add support for collections - Add support for crumb links that point to auto-generated archive pages (courtesy of Jekyll Archives plugin) and single page Liquid spaghetti pages - Improve styling --- _assets/css/_navigation.scss | 16 ++++++++++++++++ _config.yml | 14 ++++++++------ _includes/breadcrumbs.html | 16 +++++++++++++++- _pages/recipes-archive.html | 9 ++------- 4 files changed, 41 insertions(+), 14 deletions(-) diff --git a/_assets/css/_navigation.scss b/_assets/css/_navigation.scss index 2e5148d5..ac570659 100644 --- a/_assets/css/_navigation.scss +++ b/_assets/css/_navigation.scss @@ -7,6 +7,22 @@ ========================================================================== */ .breadcrumbs { + @include grid(12,10); + @include prefix(12,1); + @include suffix(12,1); + margin-bottom: 1em; + font-family: $sans-serif; + font-size: 14px; + @include breakpoint($small) { + @include grid(12,11); + @include prefix(12,0.5); + @include suffix(12,0.5); + } + @include breakpoint($x-large) { + @include grid(12,8); + @include prefix(12,2); + @include suffix(12,2) + } ol { padding: 0; list-style: none; diff --git a/_config.yml b/_config.yml index 3e3ca0ab..8dad5d91 100644 --- a/_config.yml +++ b/_config.yml @@ -15,7 +15,7 @@ url : "http://localhost:4000" # the base hostname & protoco baseurl : "/minimal-mistakes" # the subpath of your site, e.g. /blog email : "your-email@domain.com" logo : "site-logo.png" -breadcrumbs : false # true / false (default) +breadcrumbs : true # true / false (default) breadcrumb_home_label : "Home" breadcrumb_separator : "/" twitter: @@ -110,13 +110,13 @@ kramdown: collections: recipes: output: true - permalink: /:collection/:categories/:path/ + permalink: /:collection/:path/ pets: output: true - permalink: /:collection/:categories/:path/ + permalink: /:collection/:path/ portfolio: output: true - permalink: /:collection/:categories/:path/ + permalink: /:collection/:path/ # Defaults defaults: @@ -182,8 +182,10 @@ timezone: America/New_York # http://en.wikipedia.org/wiki/List_of_tz_database_ti # Type # - GitHub Pages compatible archive pages built with Liquid ~> type: liquid (default) # - Jekyll Archives plugin archive pages ~> type: jekyll-archives -# Path +# Path (examples) # - /tags/my-awesome-tag/index.html ~> path: /tags/ +# - /categories/ +# - / categories: type: liquid path: /categories/ @@ -199,7 +201,7 @@ tags: # category: archive-taxonomy # tag: archive-taxonomy # permalinks: -# category: /categories/:name/ +# category: /:name/ # tag: /tags/:name/ # HTML Compression diff --git a/_includes/breadcrumbs.html b/_includes/breadcrumbs.html index 3caff149..0fa27b11 100644 --- a/_includes/breadcrumbs.html +++ b/_includes/breadcrumbs.html @@ -1,3 +1,17 @@ +{% case site.categories.type %} + {% when "liquid" %} + {% assign path_type = "#" %} + {% when "jekyll-archives" %} + {% assign path_type = nil %} +{% endcase %} + +{% if page.collection != 'posts' %} + {% assign path_type = nil %} + {% assign crumb_path = '/' %} +{% else %} + {% assign crumb_path = site.categories.path %} +{% endif %} +