changed folder naming scheme in sidebar

This commit is contained in:
tomjohnson1492
2016-03-25 20:59:13 -07:00
parent 7f8a03d876
commit 93c21ab2c3
14 changed files with 118 additions and 96 deletions

View File

@ -1,16 +1,16 @@
entries:
- title: Sidebar
subcategories:
folders:
- title: Food
items:
folderitems:
- title: Bananas
url: bananas.html
thirdlevel:
subfolder:
- title: Apples
thirdlevelitems:
subfolderitems:
- title: Fuji apples
url: fuji_apples.html
@ -30,24 +30,24 @@ bikes:
salesteams:
- title: Regions
subitems:
subfolderitems:
- location: US
- location: Spain
- location: France
toc:
- title: Group 1
subitems:
subfolderitems:
- page: Thing 1
- page: Thing 2
- page: Thing 3
- title: Group 2
subitems:
subfolderitems:
- page: Piece 1
- page: Piece 2
- page: Piece 3
- title: Group 3
subitems:
subfolderitems:
- page: Widget 1
- page: Widget 2
- page: Widget 3

View File

@ -3,11 +3,11 @@
entries:
- title: Sidebar
levels: one
subcategories:
folders:
- title: Products
output: web
items:
folderitems:
- title: Home
url: /
output: web

View File

@ -4,12 +4,12 @@ entries:
- title: sidebar
product: Jekyll Doc Theme
version: 5.0
subcategories:
folders:
- title:
output: pdf
type: frontmatter
items:
folderitems:
- title:
url: /titlepage/
output: pdf
@ -21,7 +21,7 @@ entries:
- title: Overview
output: web, pdf
items:
folderitems:
- title: Get started
url: /
@ -50,7 +50,7 @@ entries:
- title: Installation
output: web, pdf
items:
folderitems:
- title: About Ruby, Gems, Bundler, etc.
url: /mydoc_about_ruby_gems_etc/
@ -67,7 +67,7 @@ entries:
- title: Authoring
output: web, pdf
items:
folderitems:
- title: Pages
url: /mydoc_pages/
output: web, pdf
@ -95,7 +95,7 @@ entries:
- title: Navigation
output: web, pdf
items:
folderitems:
- title: Sidebar navigation
url: /mydoc_sidebar_navigation/
output: web, pdf
@ -115,7 +115,7 @@ entries:
- title: Formatting
output: web, pdf
items:
folderitems:
- title: Tooltips
url: /mydoc_adding_tooltips/
output: web, pdf
@ -155,7 +155,7 @@ entries:
- title: Handling reviews
output: web, pdf
items:
folderitems:
- title: Commenting on files
url: /mydoc_commenting_on_files/
output: web, pdf
@ -167,7 +167,7 @@ entries:
- title: Publishing
output: web, pdf
items:
folderitems:
- title: Build arguments
url: /mydoc_build_arguments/
output: web, pdf
@ -211,7 +211,7 @@ entries:
- title: Special layouts
output: web, pdf
items:
folderitems:
- title: Knowledge-base layout
url: /mydoc_kb_layout/
output: web, pdf
@ -227,7 +227,7 @@ entries:
- title: Troubleshooting
output: web, pdf
items:
folderitems:
- title: Troubleshooting
url: /mydoc_troubleshooting/
@ -235,16 +235,16 @@ entries:
- title: Tag archives
output: web
items:
folderitems:
- title: Tag archives overview
url: /mydoc_tag_archives_overview/
output: web
thirdlevel:
subfolders:
- title: Tag archive pages
output: web
thirdlevelitems:
subfolderitems:
- title: Formatting pages
url: /tag_formatting/

View File

@ -5,12 +5,12 @@ entries:
- title: Sidebar
product: Product1
version: 1.0
subcategories:
folders:
- title:
output: pdf
type: frontmatter
items:
folderitems:
- title:
url: /titlepage/
output: pdf
@ -22,7 +22,7 @@ entries:
- title: Getting Started
output: web, pdf
items:
folderitems:
- title: Product 1 home
url: /p1_landing_page/
output: web
@ -42,7 +42,7 @@ entries:
- title: Another heading
output: web, pdf
items:
folderitems:
- title: Sample 4
url: /p1_sample4/
output: web, pdf

View File

@ -4,13 +4,13 @@ entries:
- title: Product2
product: Product2
version: 1.0
subcategories:
folders:
- title:
output: pdf
type: frontmatter
items:
folderitems:
- title:
url: /titlepage/
output: pdf
@ -22,7 +22,7 @@ entries:
- title: Getting Started
output: web, pdf
items:
folderitems:
- title: Product 2 home
url: /p2_landing_page/
@ -38,7 +38,7 @@ entries:
- title: Another heading
output: web, pdf
items:
folderitems:
- title: Sample 3
url: /p2_sample3/
@ -50,7 +50,7 @@ entries:
- title: Another heading
output: web, pdf
items:
folderitems:
- title: Sample 5
url: /p2_sample5/

View File

@ -5,11 +5,11 @@ entries:
version: all products
levels: one
output: web
subcategories:
folders:
- title: News
output: web
items:
folderitems:
- title: News
url: /news/
output: web
@ -18,7 +18,7 @@ entries:
output: web
- title: Tags
output: web
items:
folderitems:
- title: Collaboration
url: /tag_collaboration/
output: web

View File

@ -2,16 +2,16 @@
## if you want to list an external url, use external_url instead of url. the theme will apply a different link base.
topnav:
- title: Topnav
subcategories:
items:
- title: News
url: /news/
#Topnav dropdowns
topnav_dropdowns:
- title: Topnav dropdowns
subcategories:
folders:
- title: Jekyll Resources
items:
folderitems:
- title: Github Repo
external_url: https://github.com/tomjohnson1492/documentation-theme-jekyll
- title: Jekyll Talk
@ -23,7 +23,7 @@ topnav_dropdowns:
- title: Jekyll on my blog
external_url: http://idratherbewriting.com/category-jekyll/
- title: Products
items:
folderitems:
- title: Jekyll Documentation Theme
url: /mydoc_introduction/
- title: Product 1

View File

@ -1,36 +1,40 @@
{% include custom/sidebarconfigs.html %}
<ul id="mysidebar" class="nav">
<li class="sidebarTitle">{{sidebar[0].product}} {{sidebar[0].version}}</li>
{% for entry in sidebar %}
{% for subcategory in entry.subcategories %}
{% if subcategory.output contains "web" %}
{% for folder in entry.folders %}
{% if folder.output contains "web" %}
<li>
<a href="#">{{ subcategory.title }}</a>
<a href="#">{{ folder.title }}</a>
<ul>
{% for item in subcategory.items %}
{% if item.output contains "web" %}
{% if item.external_url %}
<li><a href="{{item.external_url}}" target="_blank">{{item.title}}</a></li>
{% elsif page.url == item.url %}
<li class="active"><a href="{{item.url | prepend: site.baseurl}}">{{item.title}}</a></li>
{% for folderitem in folder.folderitems %}
{% if folderitem.output contains "web" %}
{% if folderitem.external_url %}
<li><a href="{{item.external_url}}" target="_blank">{{folderitem.title}}</a></li>
{% elsif page.url == folderitem.url %}
<li class="active"><a href="{{item.url | prepend: site.baseurl}}">{{folderitem.title}}</a></li>
{% else %}
<li><a href="{{item.url | prepend: site.baseurl}}">{{item.title}}</a></li>
<li><a href="{{folderitem.url | prepend: site.baseurl}}">{{folderitem.title}}</a></li>
{% endif %}
{% for thirdlevel in item.thirdlevel %}
{% if thirdlevel.output contains "web" %}
<li class="thirdlevel">
<a href="#">{{ thirdlevel.title }}</a>
{% for subfolders in folderitem.subfolders %}
{% if subfolders.output contains "web" %}
<li class="subfolders">
<a href="#">{{ subfolders.title }}</a>
<ul>
{% for deeplevel in thirdlevel.thirdlevelitems %}
{% if deeplevel.output contains "web" %}
{% if deeplevel.external_url %}
<li><a href="{{deeplevel.external_url}}" target="_blank">{{deeplevel.title}}</a></li>
{% elsif page.url == deeplevel.url %}
<li class="active"><a href="{{deeplevel.url | prepend: site.baseurl}}">{{deeplevel.title}}</a></li>
{% for subfolderitem in subfolders.subfolderitems %}
{% if subfolderitem.output contains "web" %}
{% if subfolderitem.external_url %}
<li><a href="{{subfolderitem.external_url}}" target="_blank">{{deeplevel.title}}</a></li>
{% elsif page.url == subfolderitem.url %}
<li class="active"><a href="{{subfolderitem.url | prepend: site.baseurl}}">{{subfolderitem.title}}</a></li>
{% else %}
<li><a href="{{deeplevel.url | prepend: site.baseurl}}">{{deeplevel.title}}</a></li>
<li><a href="{{subfolderitem.url | prepend: site.baseurl}}">{{subfolderitem.title}}</a></li>
{% endif %}
{% endif %}
{% endfor %}

View File

@ -14,30 +14,30 @@
<ul class="nav navbar-nav navbar-right">
<!-- entries without drop-downs appear here -->
{% for entry in site.data.topnav.topnav %}
{% for subcategory in entry.subcategories %}
{% if subcategory.external_url %}
<li><a href="{{subcategory.external_url}}" target="_blank">{{subcategory.title}}</a></li>
{% elsif page.url contains subcategory.url %}
<li class="active"><a href="{{subcategory.url | prepend: site.baseurl}}">{{subcategory.title}}</a></li>
{% for item in entry.items %}
{% if item.external_url %}
<li><a href="{{item.external_url}}" target="_blank">{{item.title}}</a></li>
{% elsif page.url contains item.url %}
<li class="active"><a href="{{item.url | prepend: site.baseurl}}">{{item.title}}</a></li>
{% else %}
<li><a href="{{subcategory.url | prepend: site.baseurl }}">{{subcategory.title}}</a></li>
<li><a href="{{item.url | prepend: site.baseurl }}">{{item.title}}</a></li>
{% endif %}
{% endfor %}
{% endfor %}
<!-- entries with drop-downs appear here -->
<!-- conditional logic to control which topnav appears for the audience defined in the configuration file.-->
{% for entry in site.data.topnav.topnav_dropdowns %}
{% for subcategory in entry.subcategories %}
{% for folder in entry.folders %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ subcategory.title }}<b class="caret"></b></a>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ folder.title }}<b class="caret"></b></a>
<ul class="dropdown-menu">
{% for subitem in subcategory.items %}
{% if subitem.external_url %}
<li><a href="{{subitem.external_url}}" target="_blank">{{subitem.title}}</a></li>
{% elsif page.url contains subitem.url %}
<li class="dropdownActive"><a href="{{subitem.url | prepend: site.baseurl}}">{{subitem.title}}</a></li>
{% for folderitem in folder.folderitems %}
{% if folderitem.external_url %}
<li><a href="{{folderitem.external_url}}" target="_blank">{{folderitem.title}}</a></li>
{% elsif page.url contains folderitem.url %}
<li class="dropdownActive"><a href="{{folderitem.url | prepend: site.baseurl}}">{{folderitem.title}}</a></li>
{% else %}
<li><a href="{{subitem.url | prepend: site.baseurl}}">{{subitem.title}}</a></li>
<li><a href="{{folderitem.url | prepend: site.baseurl}}">{{folderitem.title}}</a></li>
{% endif %}
{% endfor %}
</ul>

View File

@ -76,15 +76,37 @@ For more detail on the sidebar, see {{site.data.urls.mydoc_sidebar_navigation.li
The sidebar data file uses a specific YAML syntax that you must follow. Follow the sample pattern shown. For example:
```yaml
- title: Overview
entries:
- title: sidebar
product: Jekyll Doc Theme
version: 5.0
folders:
- title: Overview
output: web, pdf
items:
- title: Get started
url: /mydoc_getting_started.md
folderitems:
- title: Some page
url: /some-doc-page/
output: web, pdf
- title: Another page
url: /another-doc-page/
output: web, pdf
- title: Configuration
output: web
folderitems:
- title: How to configure the system
url: /configure-system/
output: web, pdf
subfolders:
- title: Config process
output: web, pdf
subfolderitems:
- title: Creating the config file
url: /config-file-how-to/
output: web, pdf
```
Each heading must contain a title and output property. Each item must contain a title, url, and output property.
Each folder or subfolder must contain a title and output property. Each folderitem or subfolderitem must contain a title, url, and output property.
The two outputs available are web and pdf. (Even if you aren't publishing PDF, you still need to specify `output: web`).
@ -96,7 +118,7 @@ To accommodate the title page and table of contents in PDF outputs, each product
- title:
output: pdf
type: frontmatter
items:
folderitems:
- title:
url: /titlepage/
output: pdf

View File

@ -1,5 +1,5 @@
---
title: About Ruby, Gems, Bundler, and other Prerequisites
title: About Ruby, Gems, Bundler, and other prerequisites
tags: [getting_started, troubleshooting]
keywords:
summary: "Ruby is a programming language you must have on your computer in order to build Jekyll locally. Ruby has various gems (or plugins) that provide various functionality. Each Jekyll project usually requires certain gems."

View File

@ -76,7 +76,7 @@ These pages should appear in your sidebar YML file (in this product, mydoc_sideb
- title:
output: pdf
type: frontmatter
items:
folderitems:
- title:
url: /titlepage/
output: pdf

View File

@ -44,9 +44,8 @@ For example, the sidebar.html file contains the following code:
{% raw %}
```liquid
{% if item.external_url %}
<li><a href="{{item.external_url}}" target="_blank">{{subcategory.title}}</a></li>
{% elsif page.url == item.url %}
{% if subfolderitem.external_url %}
<li><a href="{{subfolderitem.external_url}}" target="_blank">{{deeplevel.title}}</a></li>
```
{% endraw %}
@ -60,15 +59,12 @@ For example, the sidebar.html file contains the following code:
{% raw %}
```liquid
{% elsif page.url == item.url %}
<li class="active"><a href="{{item.url | prepend: ".."}}">{{item.title}}</a></li>
{% else %}
<li><a href="{{item.url | prepend: ".."}}">{{item.title}}</a></li>
{% endif %}
{% elsif page.url == subfolderitem.url %}
<li class="active"><a href="{{subfolderitem.url | prepend: site.baseurl}}">{{subfolderitem.title}}</a></li>
```
{% endraw %}
If the `page.url` matches the `item.url`, then an `active` class gets applied. If not, the `active` class does not get applied.
If the `page.url` matches the `subfolderitem.url`, then an `active` class gets applied. If not, the `active` class does not get applied.
The `page.url` in Jekyll is a site-wide variable. If you insert {% raw %}`{{page.url}}`{% endraw %} on a page, it will render as follows: {{page.url}}. The `url` attribute in the sidebar item must match the page URL in order to get the `active` class applied.

View File

@ -142,7 +142,7 @@ Here we use a "for" loop to get each item in the bikes list. By using `.title` w
```yaml
salesteams:
- title: Regions
subitems:
subfolderitems:
- location: US
- location: Spain
- location: France
@ -184,17 +184,17 @@ Each list item starts with the hyphen ``. You cannot directly access the lis
```yaml
toc:
- title: Group 1
subitems:
subfolderitems:
- page: Thing 1
- page: Thing 2
- page: Thing 3
- title: Group 2
subitems:
subfolderitems:
- page: Piece 1
- page: Piece 2
- page: Piece 3
- title: Group 3
subitems:
subfolderitems:
- page: Widget 1
- page: Widget 2 it's
- page: Widget 3