reconnect
This commit is contained in:
83
.github/_includes/cb/about_the_about.md
vendored
Normal file
83
.github/_includes/cb/about_the_about.md
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
{% comment %}
|
||||
Find some sample images or use defaults for About demos
|
||||
{% endcomment %}
|
||||
{% assign imagesample = site.data[site.metadata] | where_exp: 'item','item.format contains "image"' | first %}
|
||||
{% capture imagesampleid %}{{ imagesample.objectid | default: "https://www.lib.uidaho.edu/collectionbuilder/demo-objects/mg101_b6_photographs_01.jpg" }}{% endcapture %}
|
||||
{% assign pdfsample = site.data[site.metadata] | where_exp: 'item','item.format contains "pdf"' | first %}
|
||||
{% capture pdfsampleid %}{{ pdfsample.objectid | default: "https://www.lib.uidaho.edu/collectionbuilder/demo-objects/uiext21768.pdf" }}{% endcapture %}
|
||||
{% assign videosample = site.data[site.metadata] | where_exp: 'item','item.format contains "video"' | first %}
|
||||
{% capture videosampleid %}{{ videosample.objectid | default: "https://cdil.lib.uidaho.edu/storying-extinction/objects/trailcams/videos/ballcreek-cedarrub-birdonpath.mp4" }}{% endcapture %}
|
||||
{% assign audiosample = site.data[site.metadata] | where_exp: 'item','item.format contains "audio"' | first %}
|
||||
{% capture audiosampleid %}{{ audiosample.objectid | default: "https://www.lib.uidaho.edu/digital/mp3s/Clouds.mp3" }}{% endcapture %}
|
||||
|
||||
## About the About Page
|
||||
|
||||
We want to make engaging interpretive pages easier to create, so CollectionBuilder gives you tools to write *with* your collection content!
|
||||
|
||||
The template comes with a customizable "About" page layout designed for long form content with rich media embeds.
|
||||
Content is written in [Markdown](https://guides.github.com/features/mastering-markdown/) and enhanced using "includes" that pull in collection content, external media, and [Bootstrap](https://getbootstrap.com/) features like cards and modals.
|
||||
We hope this makes it easier for site builders to develop the collection AND add interesting and engaging contextual information.
|
||||
|
||||
Each "include" file has several options, which are documented in the files themselves--copy the examples to see how it works with your content!
|
||||
In the demo below, we've given display widths of 25% and 50% to save space, but you can feature the entire image or document.
|
||||
|
||||
You can also see a page featuring [a bonanza of feature includes options](https://collectionbuilder.github.io/collectionbuilder-gh/feature_options.html) on our CollectionBuilder-GH demo site.
|
||||
|
||||
{% include feature/button.html text="Feature *Includes* Bonanza page" link="https://collectionbuilder.github.io/collectionbuilder-gh/feature_options.html" color="primary" size="lg" centered=true %}
|
||||
|
||||
### Include Collection Items
|
||||
|
||||
The template provides includes to pull your collection objects and metadata into your interpretive page, allowing you to write with your materials directly embedded in the content.
|
||||
|
||||
#### Include an Image
|
||||
|
||||
- Image --> `{% raw %}{% include feature/image.html objectid="demo_001" width="75" %}{% endraw %}`
|
||||
|
||||
{% include feature/image.html objectid=imagesampleid width="75" %}
|
||||
|
||||
#### Include a PDF
|
||||
|
||||
- PDF -- > `{% raw %}{% include feature/pdf.html objectid="demo_002" width="50" %}{% endraw %}`
|
||||
|
||||
{% include feature/pdf.html objectid=pdfsampleid width="50" %}
|
||||
|
||||
#### Include a Video
|
||||
|
||||
- Video: `{% raw %}{% include feature/video.html objectid="demo_004" %}{% endraw %}`
|
||||
|
||||
{% include feature/video.html objectid=videosampleid width="75" %}
|
||||
|
||||
#### Include an Audio File
|
||||
|
||||
- Audio: `{% raw %}{% include feature/audio.html objectid="demo_003" %}{% endraw %}`
|
||||
|
||||
{% include feature/audio.html objectid=audiosampleid %}
|
||||
|
||||
### Include Bootstrap Features
|
||||
|
||||
The template also provides includes to make it easier to add [Bootstrap](https://getbootstrap.com/) components to your Markdown writing.
|
||||
These features allow you to better organize and highlight your content.
|
||||
|
||||
#### Include a Card
|
||||
|
||||
- Card -- > `{% raw %}{% include feature/card.html header="This is a Card" text="The card features an image from the collection as a cap" objectid="demo004" width="25" centered=true %}{% endraw %}`
|
||||
|
||||
{% include feature/card.html header="This is a Card" text="The card features an image from the collection as a cap" objectid=imagesampleid width="50" centered=true %}
|
||||
|
||||
#### Include a Button
|
||||
|
||||
- Buttons -- > `{% raw %}{% include feature/button.html text="Button Link to Somewhere" link="https://collectionbuilder.github.io/" color="success" %}{% endraw %}`
|
||||
|
||||
{% include feature/button.html text="Button Link to Somewhere" link="https://collectionbuilder.github.io/" color="success" centered=true %}
|
||||
|
||||
#### Include an Alert
|
||||
|
||||
- Alerts -- > `{% raw %}{% include feature/alert.html text="this is an *alert* that 'warns' a user" color="warning" align="center" %}{% endraw %}`
|
||||
|
||||
{% include feature/alert.html text="This is an *alert* that 'warns' a user with centrally aligned text." color="warning" align="center" %}
|
||||
|
||||
#### Include a Modal
|
||||
|
||||
- Modals -- > `{% raw %}{% include feature/modal.html button="This is a modal using a 'primary' colored button to invite clicking" title="when clicked:" text="A Modal will pop out a box with some more information" color="primary" %}{% endraw %}`
|
||||
|
||||
{% include feature/modal.html button="This is a modal using a 'primary' colored button to invite clicking" title="When clicked:" text="A Modal will pop out a box with some more information" color="primary" %}
|
||||
17
.github/_includes/cb/credits.html
vendored
Normal file
17
.github/_includes/cb/credits.html
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<div class="container-fluid mt-4 mb-n3 bg-light p-4 " id="technical">
|
||||
<div class="container mt-4 border rounded p-4 bg-white">
|
||||
<h3>CollectionBuilder</h3>
|
||||
<div class="row my-2 justify-content-center">
|
||||
<div class="col-md-8 p-4">
|
||||
<p>This digital collection is built with <a href="https://collectionbuilder.github.io/">CollectionBuilder</a>, an open source framework for creating digital collection and exhibit websites that is developed by faculty librarians at the University of Idaho Library following the <a href="https://lib-static.github.io">Lib-Static</a> methodology.</p>
|
||||
|
||||
<p>Using the <a href="https://github.com/CollectionBuilder/collectionbuilder-csv">CollectionBuilder-CSV</a> template and the static website generator <a href="https://jekyllrb.com/">Jekyll</a>, this project creates an engaging interface to explore driven by metadata.</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<a href="https://collectionbuilder.github.io/" title="CollectionBuilder">
|
||||
<img src="{{ '/assets/img/collectionbuilder-logo.png' | relative_url }}" class="img-fluid" alt="CollectionBuilder" >
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
230
.github/_includes/cb/feature_options.md
vendored
Normal file
230
.github/_includes/cb/feature_options.md
vendored
Normal file
@@ -0,0 +1,230 @@
|
||||
## Feature *Includes* Bonanza page
|
||||
|
||||
Check all the includes. Steal Code!
|
||||
|
||||
----------
|
||||
|
||||
### Image Options
|
||||
|
||||
#### Image from Collection (auto caption)
|
||||
|
||||
{% include feature/image.html objectid="demo_001" width="75" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/image.html objectid="demo_001" width="75" %}{% endraw %}`
|
||||
|
||||
|
||||
#### Image from Collection (with a caption)
|
||||
|
||||
{% include feature/image.html objectid="demo_001" width="75" caption="an image" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/image.html objectid="demo_001" width="75" caption="an image" %}{% endraw %}`
|
||||
|
||||
|
||||
#### Multiple Images from the Collection (auto caption)
|
||||
|
||||
{% include feature/image.html objectid="demo_001;demo_004;demo_002" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/image.html objectid="demo_001;demo_004;demo_002" %}{% endraw %}`
|
||||
|
||||
|
||||
#### Multiple Images from the Collection (with captions)
|
||||
|
||||
{% include feature/image.html objectid="demo_001;demo_004;demo_002" width="75" caption="demo1;nother" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/image.html objectid="demo_001;demo_004;demo_002" width="75" caption="demo1;nother" %}{% endraw %}`
|
||||
|
||||
|
||||
#### External Image (without a caption)
|
||||
|
||||
{% include feature/image.html objectid="https://www.lib.uidaho.edu/collectionbuilder/demo-objects/mg101_b6_photographs_01.jpg" width="75" alt="Frank B. Robinson at the Organ" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/image.html objectid="https://www.lib.uidaho.edu/collectionbuilder/demo-objects/mg101_b6_photographs_01.jpg" width="75" alt="Frank B. Robinson at the Organ" %}{% endraw %}`
|
||||
|
||||
|
||||
#### External Image (with a caption)
|
||||
|
||||
{% include feature/image.html objectid="https://www.lib.uidaho.edu/collectionbuilder/demo-objects/mg101_b6_photographs_01.jpg" width="75" alt="Frank B. Robinson at the Organ" caption="This guy is good!"%}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/image.html objectid="https://www.lib.uidaho.edu/collectionbuilder/demo-objects/mg101_b6_photographs_01.jpg" width="75" alt="Frank B. Robinson at the Organ" caption="This guy is good!"%}{% endraw %}`
|
||||
|
||||
|
||||
#### Multiple External Images (with captions and a link)
|
||||
|
||||
{% include feature/image.html objectid="https://www.lib.uidaho.edu/collectionbuilder/demo-objects/mg101_b6_photographs_01.jpg;https://www.lib.uidaho.edu/collectionbuilder/demo-objects/mg101_b6_psychiana_photographs_010.jpg" caption="this guy!;(was nothing without these women!)" link="https://www.lib.uidaho.edu/digital/psychiana/items/psychiana519.html;https://www.lib.uidaho.edu/digital/psychiana/items/psychiana547.html" alt="Frank B. Robinson at the Organ;Women staff members of Psychiana lined up outside the Psychiana headquarters" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/image.html objectid="https://www.lib.uidaho.edu/collectionbuilder/demo-objects/mg101_b6_photographs_01.jpg;https://www.lib.uidaho.edu/collectionbuilder/demo-objects/mg101_b6_psychiana_photographs_010.jpg" caption="this guy!;(was nothing without these women!)" link="https://www.lib.uidaho.edu/digital/psychiana/items/psychiana519.html;https://www.lib.uidaho.edu/digital/psychiana/items/psychiana547.html" alt="Frank B. Robinson at the Organ;Women staff members of Psychiana lined up outside the Psychiana headquarters" %}{% endraw %}`
|
||||
|
||||
----------
|
||||
|
||||
### PDF Options
|
||||
|
||||
#### PDF from Collection (auto caption)
|
||||
|
||||
{% include feature/pdf.html objectid="demo_002" width="50" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/pdf.html objectid="demo_002" width="50" %}{% endraw %}`
|
||||
|
||||
|
||||
#### PDF from the Collection (with a caption)
|
||||
|
||||
{% include feature/pdf.html objectid="demo_002" width="50" caption="a pdf from the collection" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/pdf.html objectid="demo_002" width="50" caption="a pdf from the collection" %}{% endraw %}`
|
||||
|
||||
|
||||
#### External PDF (without a caption)
|
||||
|
||||
{% include feature/pdf.html objectid="https://www.lib.uidaho.edu/collectionbuilder/demo-objects/uiext21768.pdf" width="50" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/pdf.html objectid="https://www.lib.uidaho.edu/collectionbuilder/demo-objects/uiext21768.pdf" width="50" %}{% endraw %}`
|
||||
|
||||
|
||||
#### External PDF (with a caption)
|
||||
|
||||
{% include feature/pdf.html objectid="https://www.lib.uidaho.edu/collectionbuilder/demo-objects/uiext21768.pdf" width="50" caption="Safe Chainsawing is Important!" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/pdf.html objectid="https://www.lib.uidaho.edu/collectionbuilder/demo-objects/uiext21768.pdf" width="50" caption="Safe Chainsawing is Important!" %}{% endraw %}`
|
||||
|
||||
----------
|
||||
|
||||
### Video Options
|
||||
|
||||
#### Video from Collection (auto caption)
|
||||
|
||||
{% include feature/video.html objectid="demo_004" width="75" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/video.html objectid="demo_004" width="75" %}{% endraw %}`
|
||||
|
||||
|
||||
#### Video from the Collection (with a caption)
|
||||
|
||||
{% include feature/video.html objectid="demo_005" width="50" caption="a video from the collection" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/video.html objectid="demo_004" width="50" caption="a video from the collection" %}{% endraw %}`
|
||||
|
||||
|
||||
#### External Video File (without a caption)
|
||||
|
||||
{% include feature/video.html objectid="https://cdil.lib.uidaho.edu/storying-extinction/objects/trailcams/videos/ballcreek-cedarrub-birdonpath.mp4" width="50"%}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/video.html objectid="https://cdil.lib.uidaho.edu/storying-extinction/objects/trailcams/videos/ballcreek-cedarrub-birdonpath.mp4" width="50"%}{% endraw %}`
|
||||
|
||||
|
||||
#### External Video File (with a caption)
|
||||
|
||||
{% include feature/video.html objectid="https://cdil.lib.uidaho.edu/storying-extinction/objects/trailcams/videos/ballcreek-cedarrub-birdonpath.mp4" caption="Bears are Important!" width="50" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/video.html objectid="https://cdil.lib.uidaho.edu/storying-extinction/objects/trailcams/videos/ballcreek-cedarrub-birdonpath.mp4" caption="Bears are Important!" width="50" %}{% endraw %}`
|
||||
|
||||
|
||||
#### External Vimeo Video
|
||||
|
||||
{% include feature/video.html objectid="https://vimeo.com/464555587" width="50" caption="vimeo caption" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/video.html objectid="https://vimeo.com/464555587" width="50" caption="vimeo caption" %}{% endraw %}`
|
||||
|
||||
|
||||
#### External Youtube Video
|
||||
|
||||
{% include feature/video.html objectid="https://www.youtube.com/watch?v=dbKNr3wuiuQ" width="50" caption="youtube caption" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/video.html objectid="https://www.youtube.com/watch?v=dbKNr3wuiuQ" width="50" caption="youtube caption" %}{% endraw %}`
|
||||
|
||||
#### Video Modal from Collection
|
||||
|
||||
{% include feature/video-modal.html objectid="demo_004" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/video-modal.html objectid="demo_004" %}{% endraw %}`
|
||||
|
||||
#### Video Modal External Item
|
||||
|
||||
{% include feature/video-modal.html objectid="https://cdil.lib.uidaho.edu/storying-extinction/objects/trailcams/videos/ballcreek-cedarrub-birdonpath.mp4" caption="Bears are Important!" transcript="Example transcript text, this should be better!" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/video-modal.html objectid="https://cdil.lib.uidaho.edu/storying-extinction/objects/trailcams/videos/ballcreek-cedarrub-birdonpath.mp4" caption="Bears are Important!" transcript="Example transcript text, this should be better!" %}{% endraw %}`
|
||||
|
||||
----------
|
||||
|
||||
### Audio Options
|
||||
|
||||
#### Audio from Collection (auto caption)
|
||||
|
||||
{% include feature/audio.html objectid="demo_003" width="50" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/audio.html objectid="demo_003" width="50" %}{% endraw %}`
|
||||
|
||||
|
||||
#### Audio from the Collection (with a caption)
|
||||
|
||||
{% include feature/audio.html objectid="demo_003" width="50" caption="a mp3 from the collection" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/audio.html objectid="demo_003" width="50" caption="a mp3 from the collection" %}{% endraw %}`
|
||||
|
||||
|
||||
#### External Audio (without a caption)
|
||||
|
||||
{% include feature/audio.html objectid="https://www.lib.uidaho.edu/digital/mp3s/Clouds.mp3" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/audio.html objectid="https://www.lib.uidaho.edu/digital/mp3s/Clouds.mp3" %}{% endraw %}`
|
||||
|
||||
|
||||
#### External Audio (with a caption)
|
||||
|
||||
{% include feature/audio.html objectid="https://www.lib.uidaho.edu/digital/mp3s/Clouds.mp3" width="50" caption="Clouds are Important!" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/audio.html objectid="https://www.lib.uidaho.edu/digital/mp3s/Clouds.mp3" width="50" caption="Clouds are Important!" %}{% endraw %}`
|
||||
|
||||
#### Audio Modal from Collection
|
||||
|
||||
{% include feature/audio-modal.html objectid="demo_003" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/audio-modal.html objectid="demo_003" %}{% endraw %}`
|
||||
|
||||
#### Audio Modal External Item
|
||||
|
||||
{% include feature/audio-modal.html objectid="https://www.lib.uidaho.edu/digital/mp3s/Clouds.mp3" title="Clouds" caption="A reading." transcript="Example transcript text, this should be better!" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/audio-modal.html objectid="https://www.lib.uidaho.edu/digital/mp3s/Clouds.mp3" title="Clouds" caption="A reading." transcript="Example transcript text, this should be better!" %}{% endraw %}`
|
||||
|
||||
----------
|
||||
|
||||
### Other Features
|
||||
|
||||
#### Cloud Include
|
||||
|
||||
{% include feature/cloud.html fields="subject" min="1" background="dark" button="outline-warning" %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/cloud.html fields="subject" min="1" background="dark" button="outline-warning" %}{% endraw %}`
|
||||
|
||||
#### TimelineJS
|
||||
|
||||
{% include feature/timelinejs.html %}
|
||||
|
||||
Example Code --> `{% raw %}{% include feature/timelinejs.html %}{% endraw %}`
|
||||
|
||||
----------
|
||||
|
||||
### [Bootstrap](https://getbootstrap.com/) Features
|
||||
|
||||
#### Include a Card
|
||||
|
||||
- Card -- > `{% raw %}{% include feature/card.html header="This is a Card" text="The card features an image from the collection as a cap" objectid="demo004" width="25" centered=true %}{% endraw %}`
|
||||
|
||||
{% include feature/card.html header="This is a Card" text="The card features an image from the collection as a cap" objectid="demo_001" width="25" centered=true %}
|
||||
|
||||
#### Include a Button
|
||||
|
||||
- Buttons -- > `{% raw %}{% include feature/button.html text="Button Link to Somewhere" link="https://collectionbuilder.github.io/" color="success" %}{% endraw %}`
|
||||
|
||||
{% include feature/button.html text="Button Link to Somewhere" link="https://collectionbuilder.github.io/" color="success" centered=true %}
|
||||
|
||||
#### Include an Alert
|
||||
|
||||
- Alerts -- > `{% raw %}{% include feature/alert.html text="this is an *alert* that 'warns' a user" color="warning" align="center" %}{% endraw %}`
|
||||
|
||||
{% include feature/alert.html text="This is an *alert* that 'warns' a user with centrally aligned text." color="warning" align="center" %}
|
||||
|
||||
#### Include a Modal
|
||||
|
||||
- Modals -- > `{% raw %}{% include feature/modal.html button="This is a modal using a 'primary' colored button to invite clicking" title="when clicked:" text="A Modal will pop out a box with some more information" color="primary" %}{% endraw %}`
|
||||
|
||||
{% include feature/modal.html button="This is a modal using a 'primary' colored button to invite clicking" title="When clicked:" text="A Modal will pop out a box with some more information" color="primary" %}
|
||||
186
.github/_includes/cb/jekyll-toc.html
vendored
Normal file
186
.github/_includes/cb/jekyll-toc.html
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
{% capture tocWorkspace %}
|
||||
{% comment %}
|
||||
Copyright (c) 2017 Vladimir "allejo" Jimenez
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
{% endcomment %}
|
||||
{% comment %}
|
||||
Version 1.2.0
|
||||
https://github.com/allejo/jekyll-toc
|
||||
|
||||
"...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe
|
||||
|
||||
Usage:
|
||||
{% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %}
|
||||
|
||||
Parameters:
|
||||
* html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
|
||||
|
||||
Optional Parameters:
|
||||
* sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC
|
||||
* class (string) : '' - a CSS class assigned to the TOC
|
||||
* id (string) : '' - an ID to assigned to the TOC
|
||||
* h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored
|
||||
* h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored
|
||||
* ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list
|
||||
* item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level
|
||||
* submenu_class (string) : '' - add custom class(es) for each child group of headings; has support for '%level%' placeholder which is the current "submenu" heading level
|
||||
* base_url (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content
|
||||
* anchor_class (string) : '' - add custom class(es) for each anchor element
|
||||
* skip_no_ids (bool) : false - skip headers that do not have an `id` attribute
|
||||
|
||||
Output:
|
||||
An ordered or unordered list representing the table of contents of a markdown block. This snippet will only
|
||||
generate the table of contents and will NOT output the markdown given to it
|
||||
|
||||
Modified:
|
||||
Functionality was modified for CollectionBuilder's context to allow site's creator to trigger a link to the technical credits in the side nav. Additions include lines 165-167 in this file, and the addition of an optional "credits" parameter in the include. credits=true will add "Technical" to the side nav with a link to the #technical anchor. credits=false or not including credits will remove "Technical" from the side nav.
|
||||
{% endcomment %}
|
||||
|
||||
{% capture newline %}
|
||||
{% endcapture %}
|
||||
{% assign newline = newline | rstrip %} <!-- Remove the extra spacing but preserve the newline -->
|
||||
|
||||
{% capture deprecation_warnings %}{% endcapture %}
|
||||
|
||||
{% if include.baseurl %}
|
||||
{% capture deprecation_warnings %}{{ deprecation_warnings }}<!-- jekyll-toc :: "baseurl" has been deprecated, use "base_url" instead -->{{ newline }}{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if include.skipNoIDs %}
|
||||
{% capture deprecation_warnings %}{{ deprecation_warnings }}<!-- jekyll-toc :: "skipNoIDs" has been deprecated, use "skip_no_ids" instead -->{{ newline }}{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% capture jekyll_toc %}{% endcapture %}
|
||||
{% assign orderedList = include.ordered | default: false %}
|
||||
{% assign baseURL = include.base_url | default: include.baseurl | default: '' %}
|
||||
{% assign skipNoIDs = include.skip_no_ids | default: include.skipNoIDs | default: false %}
|
||||
{% assign minHeader = include.h_min | default: 1 %}
|
||||
{% assign maxHeader = include.h_max | default: 6 %}
|
||||
{% assign nodes = include.html | strip | split: '<h' %}
|
||||
|
||||
{% assign firstHeader = true %}
|
||||
{% assign currLevel = 0 %}
|
||||
{% assign lastLevel = 0 %}
|
||||
|
||||
{% capture listModifier %}{% if orderedList %}ol{% else %}ul{% endif %}{% endcapture %}
|
||||
|
||||
{% for node in nodes %}
|
||||
{% if node == "" %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
||||
{% assign currLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %}
|
||||
|
||||
{% if currLevel < minHeader or currLevel > maxHeader %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
||||
{% assign _workspace = node | split: '</h' %}
|
||||
|
||||
{% assign _idWorkspace = _workspace[0] | split: 'id="' %}
|
||||
{% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
|
||||
{% assign htmlID = _idWorkspace[0] %}
|
||||
|
||||
{% assign _classWorkspace = _workspace[0] | split: 'class="' %}
|
||||
{% assign _classWorkspace = _classWorkspace[1] | split: '"' %}
|
||||
{% assign htmlClass = _classWorkspace[0] %}
|
||||
|
||||
{% if htmlClass contains "no_toc" %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
||||
{% if firstHeader %}
|
||||
{% assign minHeader = currLevel %}
|
||||
{% endif %}
|
||||
|
||||
{% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
|
||||
{% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}
|
||||
|
||||
{% if include.item_class and include.item_class != blank %}
|
||||
{% capture listItemClass %} class="{{ include.item_class | replace: '%level%', currLevel | split: '.' | join: ' ' }}"{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if include.submenu_class and include.submenu_class != blank %}
|
||||
{% assign subMenuLevel = currLevel | minus: 1 %}
|
||||
{% capture subMenuClass %} class="{{ include.submenu_class | replace: '%level%', subMenuLevel | split: '.' | join: ' ' }}"{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% capture anchorBody %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %}
|
||||
|
||||
{% if htmlID %}
|
||||
{% capture anchorAttributes %} href="{% if baseURL %}{{ baseURL }}{% endif %}#{{ htmlID }}"{% endcapture %}
|
||||
{% if include.anchor_class %}
|
||||
{% capture anchorAttributes %}{{ anchorAttributes }} class="{{ include.anchor_class | split: '.' | join: ' ' }}"{% endcapture %}
|
||||
{% endif %}
|
||||
{% capture listItem %}<a{{ anchorAttributes }}>{{ anchorBody }}</a>{% endcapture %}
|
||||
{% elsif skipNoIDs == true %}
|
||||
{% continue %}
|
||||
{% else %}
|
||||
{% capture listItem %}{{ anchorBody }}{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if currLevel > lastLevel %}
|
||||
{% capture jekyll_toc %}{{ jekyll_toc }}<{{ listModifier }}{{ subMenuClass }}>{% endcapture %}
|
||||
{% elsif currLevel < lastLevel %}
|
||||
{% assign repeatCount = lastLevel | minus: currLevel %}
|
||||
{% for i in (1..repeatCount) %}
|
||||
{% capture jekyll_toc %}{{ jekyll_toc }}</li></{{ listModifier }}>{% endcapture %}
|
||||
{% endfor %}
|
||||
{% capture jekyll_toc %}{{ jekyll_toc }}</li>{% endcapture %}
|
||||
{% else %}
|
||||
{% capture jekyll_toc %}{{ jekyll_toc }}</li>{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% capture jekyll_toc %}{{ jekyll_toc }}<li{{ listItemClass }}>{{ listItem }}{% endcapture %}
|
||||
|
||||
{% assign lastLevel = currLevel %}
|
||||
{% assign firstHeader = false %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% assign repeatCount = minHeader | minus: 1 %}
|
||||
{% assign repeatCount = lastLevel | minus: repeatCount %}
|
||||
|
||||
{% for i in (1..repeatCount) %}
|
||||
{% if i == repeatCount and include.credits == true %}
|
||||
{% capture jekyll_toc %}{{ jekyll_toc }}<li><a href="#technical">Technical</a>{% endcapture %}
|
||||
{% endif %}
|
||||
{% capture jekyll_toc %}{{ jekyll_toc }}</li></{{ listModifier }}>{% endcapture %}
|
||||
{% endfor %}
|
||||
|
||||
{% if jekyll_toc != '' %}
|
||||
{% assign rootAttributes = '' %}
|
||||
{% if include.class and include.class != blank %}
|
||||
{% capture rootAttributes %} class="{{ include.class | split: '.' | join: ' ' }}"{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if include.id and include.id != blank %}
|
||||
{% capture rootAttributes %}{{ rootAttributes }} id="{{ include.id }}"{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if rootAttributes %}
|
||||
{% assign nodes = jekyll_toc | split: '>' %}
|
||||
{% capture jekyll_toc %}<{{ listModifier }}{{ rootAttributes }}>{{ nodes | shift | join: '>' }}>{% endcapture %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endcapture %}{% assign tocWorkspace = '' %}{{ deprecation_warnings }}{{ jekyll_toc -}}
|
||||
Reference in New Issue
Block a user