Add support for folder urls in the sidebar.
If present, clicking the folder goes to the URL itself. Toggling the folder requires clicking the toggle arrow precisely. If URL is omitted, the whole folder title works as a toggle.
This commit is contained in:
@ -3,12 +3,16 @@
|
||||
<li class="sidebarTitle">{{sidebar[0].product}} {{sidebar[0].version}}</li>
|
||||
{% for entry in sidebar %}
|
||||
{% for folder in entry.folders %}
|
||||
{% if folder.output contains "web" %}
|
||||
{% if folder.output == nil or folder.output contains "web"%}
|
||||
{% if folder.url != nil and page.url contains folder.url %}
|
||||
<li class = "active" >
|
||||
{% else %}
|
||||
<li>
|
||||
<a title="{{folder.title}}" href="#">{{folder.title}}</a>
|
||||
{% endif %}
|
||||
<a title="{{folder.title}}" href="{{folder.url | default:"#" }}">{{folder.title}}</a>
|
||||
<ul>
|
||||
{% for folderitem in folder.folderitems %}
|
||||
{% if folderitem.output contains "web" %}
|
||||
{% if folderitem.output == nil or folderitem.output contains "web" %}
|
||||
{% if folderitem.external_url %}
|
||||
<li><a title="{{folderitem.title}}" href="{{folderitem.external_url}}" target="_blank" rel="noopener">{{folderitem.title}}</a></li>
|
||||
{% elsif page.url contains folderitem.url %}
|
||||
@ -20,12 +24,12 @@
|
||||
<li><a title="{{folderitem.title}}" href="{{folderitem.url | relative_url}}">{{folderitem.title}}</a></li>
|
||||
{% endif %}
|
||||
{% for subfolders in folderitem.subfolders %}
|
||||
{% if subfolders.output contains "web" %}
|
||||
{% if subfolders.output == nil or subfolders.output contains "web" %}
|
||||
<li class="subfolders">
|
||||
<a title="{{subfolders.title}}" href="#">{{ subfolders.title }}</a>
|
||||
<a title="{{subfolders.title}}" href="{{subfolders.url | default:"#" }}">{{ subfolders.title }}</a>
|
||||
<ul>
|
||||
{% for subfolderitem in subfolders.subfolderitems %}
|
||||
{% if subfolderitem.output contains "web" %}
|
||||
{% if subfolderitem.output == nil or subfolderitem.output contains "web" %}
|
||||
{% if subfolderitem.external_url %}
|
||||
<li><a title="{{subfolderitem.title}}" href="{{subfolderitem.external_url}}" target="_blank" rel="noopener">{{subfolderitem.title}}</a></li>
|
||||
{% elsif page.url == subfolderitem.url %}
|
||||
@ -60,4 +64,4 @@ 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>
|
||||
<script>$("li.active").parents('li').addClass("active");</script>
|
||||
|
Reference in New Issue
Block a user