Skip to content

Commit

Permalink
Merge pull request #252 from alphagov/single-page-example
Browse files Browse the repository at this point in the history
Add page with single page navigation to example
  • Loading branch information
36degrees committed Jul 29, 2021
2 parents f563c3e + a19a918 commit 9cf97f6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions example/config/tech-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ header_links:
Expired page: /expired-page.html
Expired with owner: /expired-page-with-owner.html
Not expired page: /not-expired-page.html
Single page nav: /single-page-nav.html

footer_links:
Accessibility: /hidden-page.html
Expand Down
13 changes: 13 additions & 0 deletions example/source/single-page-nav.html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
layout: layout
multipage_nav: false
hide_in_navigation: true
---

# A page that does not use multi-page navigation

## A subheader

### A h3 subheader

## Another subheader
4 changes: 3 additions & 1 deletion lib/source/layouts/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ wrap_layout :core do

content_for(:toc_module, "in-page-navigation")

use_multipage_nav = current_page.data.fetch(:multipage_nav, config[:tech_docs][:multipage_nav])

content_for :sidebar do
if config[:tech_docs][:multipage_nav] %>
if use_multipage_nav %>
<%= multi_page_table_of_contents(sitemap.resources, current_page, config, html) %>
<% else %>
<%= single_page_table_of_contents(html, max_level: config[:tech_docs][:max_toc_heading_level]) %>
Expand Down

0 comments on commit 9cf97f6

Please sign in to comment.