Skip to content

Commit

Permalink
Don't leave a blank space when there's no lead paragraph on a page
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Gurnell committed Aug 6, 2013
1 parent c841959 commit 1645e54
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions _config.yml
Expand Up @@ -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:
Expand Down
14 changes: 9 additions & 5 deletions _layouts/page.html
Expand Up @@ -3,11 +3,15 @@
---
<h1>{{ page.title }}</h1>

<p class="lead">
<small>
{% if page.lead %}{{ page.lead }}{% else %}&nbsp;{% endif %}
</small>
</p>
{% if page.lead %}
<p class="lead">
<small>
{{ page.lead }}
</small>
</p>
{% endif %}

<hr>

<div class="row">
<div class="col-lg-3 col-md-3">
Expand Down
4 changes: 2 additions & 2 deletions _plugins/nav_pager.rb
Expand Up @@ -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 }
Expand Down

0 comments on commit 1645e54

Please sign in to comment.