From 1645e54fefd3bc86392e6b366c6cb29c915ecd20 Mon Sep 17 00:00:00 2001 From: Dave Gurnell Date: Tue, 6 Aug 2013 17:23:37 +0100 Subject: [PATCH] Don't leave a blank space when there's no lead paragraph on a page --- _config.yml | 4 ++-- _layouts/page.html | 14 +++++++++----- _plugins/nav_pager.rb | 4 ++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/_config.yml b/_config.yml index 1690b20..a13eace 100644 --- a/_config.yml +++ b/_config.yml @@ -19,8 +19,8 @@ toc: - head: '/index.html' body: [] - #- head: '/dashboard/index.html' - # body: [] + # - head: '/dashboard/index.html' + # body: [] - head: '/deployment/web/index.html' body: diff --git a/_layouts/page.html b/_layouts/page.html index 828ebcd..8f0d2ff 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -3,11 +3,15 @@ ---

{{ page.title }}

-

- - {% if page.lead %}{{ page.lead }}{% else %} {% endif %} - -

+{% if page.lead %} +

+ + {{ page.lead }} + +

+{% endif %} + +
diff --git a/_plugins/nav_pager.rb b/_plugins/nav_pager.rb index a61b1e9..6998708 100644 --- a/_plugins/nav_pager.rb +++ b/_plugins/nav_pager.rb @@ -6,8 +6,8 @@ def render(context) toc = site.config['toc'].flat_map { |item| flattened_toc(item) } curr_index = toc.find_index { |item| item == page['url'] } - prev_index = (curr_index > 0) && curr_index - 1 - next_index = (curr_index < toc.length - 1) && curr_index + 1 + prev_index = curr_index && (curr_index > 0) && curr_index - 1 + next_index = curr_index && (curr_index < toc.length - 1) && curr_index + 1 prev_path = prev_index && toc[prev_index] prev_page = prev_index && site.pages.find { |page| page.url == prev_path }