Adding a feature to support hiding sidebar on pages

This commit is contained in:
Charles Prakash Dasari
2017-04-25 12:19:43 -07:00
parent 822cf1fd7d
commit 009cb9c980
4 changed files with 18 additions and 11 deletions

View File

@ -40,7 +40,8 @@
{% endif %}
{% endfor %}
</ul>
{% endif %}
</li>
{% endif %}
{% endfor %}
{% endfor %}
<!-- if you aren't using the accordion, uncomment this block:
@ -48,9 +49,7 @@
<a href="#" id="collapseAll">Collapse All</a> | <a href="#" id="expandAll">Expand All</a>
</p>
-->
</li>
</ul>
</div>
<!-- this highlights the active parent class in the navgoco sidebar. this is critical so that the parent expands when you're viewing a page. This must appear below the sidebar code above. Otherwise, if placed inside customscripts.js, the script runs before the sidebar code runs and the class never gets inserted.-->
<script>$("li.active").parents('li').toggleClass("active");</script>

View File

@ -62,7 +62,7 @@
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
dataSource: '{{ "search.json" }}',
searchResultTemplate: '<li><a href="{url}" title="{{page.title | replace: "'", "\"}}">{title}</a></li>',
searchResultTemplate: '<li><a href="{url}" title="{{page.title | replace: "\'", "\"}}">{title}</a></li>',
noResultsText: '{{site.data.strings.search_no_results_text}}',
limit: 10,
fuzzy: true,

View File

@ -1,4 +1,5 @@
<!DOCTYPE html>
<html>
<head>
{% include head.html %}
<script>
@ -78,14 +79,19 @@
<div class="col-lg-12">&nbsp;</div>
<!-- Content Row -->
<div class="row">
<!-- Sidebar Column -->
<div class="col-md-3" id="tg-sb-sidebar">
{% assign content_col_size = "col-md-12" %}
{% unless page.hide_sidebar %}
<!-- Sidebar Column -->
<div class="col-md-3" id="tg-sb-sidebar">
{% include sidebar.html %}
</div>
{% assign content_col_size = "col-md-9" %}
{% endunless %}
{% include sidebar.html %}
<!-- Content Column -->
<div class="col-md-9" id="tg-sb-content">
{{content}}
</div>
<!-- Content Column -->
<div class="{{content_col_size}}" id="tg-sb-content">
{{content}}
</div>
<!-- /.row -->
</div>
<!-- /.container -->

View File

@ -138,6 +138,8 @@ Note that your sidebar can only have 2 levels. Given that each product has its o
{% include note.html content="Note that each level must have at least one topic before the next level starts. You can't have a second level that contains multiple third levels without having at least one standalone topic in the second level." %}
You can optionally turn off the sidebar on any page (e.g. landing pages). To turn off the sidebar for a page, you should set the page frontmatter tag as `hide_sidebar: true`.
For more detail on the sidebar, see [Sidebar navigation][mydoc_sidebar_navigation].
## Sidebar syntax