diff --git a/Gemfile b/Gemfile index 30bbd06..084fbd1 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,7 @@ group :jekyll do gem 'jekyll' gem 'jekyll-sitemap' gem 'jekyll-redirect-from' + gem 'jekyll-toc' gem 'redcarpet' end diff --git a/_config.yml b/_config.yml index 1b2de8c..7c57102 100644 --- a/_config.yml +++ b/_config.yml @@ -94,11 +94,19 @@ collections: output: true permalink: /:collection/:path/ +defaults: + - scope: + path: "" + type: guides + values: + toc: true + # Plugins # -------------------- plugins: - jekyll-sitemap - jekyll-redirect-from + - jekyll-toc jekyll_get: diff --git a/_src/_assets/javascripts/bigchain.js b/_src/_assets/javascripts/bigchain.js index 1cf1bec..ebef934 100644 --- a/_src/_assets/javascripts/bigchain.js +++ b/_src/_assets/javascripts/bigchain.js @@ -23,7 +23,7 @@ jQuery(function($) { // // init Smooth Scroll // - var scroll = new SmoothScroll('a[data-scroll]', { + var scroll = new SmoothScroll('a[data-scroll], .toc-entry a', { easing: 'easeOutQuint' }); diff --git a/_src/_assets/styles/_page-guides.scss b/_src/_assets/styles/_page-guides.scss index e2a6d5c..d8c81bb 100644 --- a/_src/_assets/styles/_page-guides.scss +++ b/_src/_assets/styles/_page-guides.scss @@ -65,3 +65,49 @@ h1.guide__title { margin-top: 0; color: $brand-primary; } + +// +// TOC +// +.section-nav { + background: darken($brand-main-gray, 2%); + margin-bottom: $spacer * 2; + padding: $spacer; + border-radius: $border-radius; +} + +.toc-entry { + +} + +li.toc-h1 { + margin-bottom: $spacer / 2; + + // custom numbers + &:before { + font-size: $font-size-h5; + opacity: .5; + } + + a { + @extend .h5; + margin: 0; + box-shadow: none; + color: $brand-primary; + } + + ul { + padding-left: $spacer * 3; + } +} + +li.toc-h2 { + a { + font-size: $font-size-base; + color: $text-color; + } +} + +li.toc-h3 { + display: none; +} diff --git a/_src/_assets/styles/bigchain/_toc.scss b/_src/_assets/styles/bigchain/_toc.scss index e3afd59..39f55ce 100644 --- a/_src/_assets/styles/bigchain/_toc.scss +++ b/_src/_assets/styles/bigchain/_toc.scss @@ -7,27 +7,27 @@ li { padding-left: 0; } &:before { - @extend .h1; - content: 'Table Of Contents'; + @extend .h5; + content: 'Contents'; display: block; - border-bottom: 1px solid $brand-main-blue-light; - padding-bottom: $spacer; - margin-bottom: ($spacer * 2); - text-align: center; + margin-top: 0; } li, - ol { margin: 0; } + ol, + ul { margin: 0; } li { display: block; + } + > li { // custom numbers &:before { - content: counters(item, '.') ' '; + content: counters(item, '.') '. '; counter-increment: item; - margin-right: $spacer; - color: $brand-main-gray; + margin-right: $spacer / 4; + color: $brand-main-gray-light; } } } @@ -35,7 +35,8 @@ // output by Kramdown /* stylelint-disable selector-no-id */ -#markdown-toc { +#markdown-toc, +.section-nav { @extend .toc; } diff --git a/_src/_includes/sections/section-guides.html b/_src/_includes/sections/section-guides.html new file mode 100644 index 0000000..ba234dd --- /dev/null +++ b/_src/_includes/sections/section-guides.html @@ -0,0 +1,25 @@ +
+
+
+

Guides

+

Complete these guides to learn about how to create apps in BigchainDB.

+
+
+
+
+ {% for guide in site.guides limit: 4 %} + + {% endfor %} +
+
+
+ All guides +
+
diff --git a/_src/_layouts/guide.html b/_src/_layouts/guide.html index 71e9be8..d4ee64c 100644 --- a/_src/_layouts/guide.html +++ b/_src/_layouts/guide.html @@ -23,7 +23,7 @@ layout: base {% endif %} - {{ content }} + {{ content | toc }} @@ -47,6 +47,6 @@ layout: base
- All guides + All guides
diff --git a/_src/guides.html b/_src/guides.html index f7eb3d0..bf96d1b 100644 --- a/_src/guides.html +++ b/_src/guides.html @@ -2,6 +2,8 @@ layout: page title: Guides + +js: page-guides.min.js ---
@@ -24,4 +26,4 @@ title: Guides {% endfor %} -
\ No newline at end of file + diff --git a/_src/index.html b/_src/index.html index c77c06e..0bcaaaf 100644 --- a/_src/index.html +++ b/_src/index.html @@ -64,31 +64,7 @@ intro: -
-
-
-

Guides

-

Complete these guides to learn about how to create apps in BigchainDB.

-
-
-
-
- {% for guide in site.guides limit: 4 %} - - {% endfor %} -
-
-
- All guides -
-
+{% include sections/section-guides.html %} {% include sections/section-partners.html %}