mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-04-17 00:22:24 -06:00
Added doc collections and categories
This commit is contained in:
parent
654da0a6ef
commit
93f93f48a7
@ -1,6 +1,6 @@
|
|||||||
<ul class="nav-list">
|
<ul class="nav-list">
|
||||||
{%- assign ordered_pages_list = site.html_pages | where_exp:"item", "item.nav_order != nil" -%}
|
{%- assign ordered_pages_list = include.pages | where_exp:"item", "item.nav_order != nil" -%}
|
||||||
{%- assign unordered_pages_list = site.html_pages | where_exp:"item", "item.nav_order == nil" -%}
|
{%- assign unordered_pages_list = include.pages | where_exp:"item", "item.nav_order == nil" -%}
|
||||||
{%- if site.nav_sort == 'case_insensitive' -%}
|
{%- if site.nav_sort == 'case_insensitive' -%}
|
||||||
{%- assign sorted_ordered_pages_list = ordered_pages_list | sort_natural:"nav_order" -%}
|
{%- assign sorted_ordered_pages_list = ordered_pages_list | sort_natural:"nav_order" -%}
|
||||||
{%- assign sorted_unordered_pages_list = unordered_pages_list | sort_natural:"title" -%}
|
{%- assign sorted_unordered_pages_list = unordered_pages_list | sort_natural:"title" -%}
|
||||||
|
@ -48,7 +48,19 @@ layout: table_wrappers
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<nav role="navigation" aria-label="Main" id="site-nav" class="site-nav">
|
<nav role="navigation" aria-label="Main" id="site-nav" class="site-nav">
|
||||||
{% include nav.html %}
|
{% if site.doc_collections %}
|
||||||
|
{% assign doc_collections_size = site.doc_collections | size %}
|
||||||
|
{% for doc_collection in site.doc_collections %}
|
||||||
|
{% assign name = doc_collection.name %}
|
||||||
|
{% assign collection = site[doc_collection.collection] %}
|
||||||
|
{% if doc_collections_size > 1 %}
|
||||||
|
<div class="nav-category">{{ name }}</div>
|
||||||
|
{% endif %}
|
||||||
|
{% include nav.html pages=collection %}
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
{% include nav.html pages=site.html_pages %}
|
||||||
|
{% endif %}
|
||||||
</nav>
|
</nav>
|
||||||
<footer class="site-footer">
|
<footer class="site-footer">
|
||||||
This site uses <a href="https://github.com/pmarsceill/just-the-docs">Just the Docs</a>, a documentation theme for Jekyll.
|
This site uses <a href="https://github.com/pmarsceill/just-the-docs">Just the Docs</a>, a documentation theme for Jekyll.
|
||||||
|
@ -131,6 +131,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nav-category {
|
||||||
|
padding-top: $sp-2;
|
||||||
|
padding-right: $gutter-spacing-sm;
|
||||||
|
padding-bottom: $sp-2;
|
||||||
|
padding-left: $gutter-spacing-sm;
|
||||||
|
font-weight: 600;
|
||||||
|
text-align: end;
|
||||||
|
text-transform: uppercase;
|
||||||
|
border-bottom: $border $border-color;
|
||||||
|
@include fs-2;
|
||||||
|
|
||||||
|
@include mq(md) {
|
||||||
|
padding-right: $gutter-spacing;
|
||||||
|
padding-left: $gutter-spacing;
|
||||||
|
margin-top: $gutter-spacing-sm;
|
||||||
|
text-align: start;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Aux nav
|
// Aux nav
|
||||||
|
|
||||||
.aux-nav {
|
.aux-nav {
|
||||||
|
@ -2,8 +2,17 @@
|
|||||||
permalink: /assets/js/search-data.json
|
permalink: /assets/js/search-data.json
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
{%- assign i = 0 -%}
|
{% assign i = 0 -%}
|
||||||
{% for page in site.html_pages %}
|
{%- assign pages_array = '' | split: '' -%}
|
||||||
|
{%- assign pages_array = pages_array | push: site.html_pages -%}
|
||||||
|
{%- if site.doc_collections -%}
|
||||||
|
{%- for doc_collection in site.doc_collections -%}
|
||||||
|
{%- assign collection = site[doc_collection.collection] -%}
|
||||||
|
{%- assign pages_array = pages_array | push: collection -%}
|
||||||
|
{%- endfor -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- for pages in pages_array -%}
|
||||||
|
{%- for page in pages -%}
|
||||||
{%- if page.title and page.search_exclude != true -%}
|
{%- if page.title and page.search_exclude != true -%}
|
||||||
{%- assign page_content = page.content -%}
|
{%- assign page_content = page.content -%}
|
||||||
{%- assign heading_level = site.search.heading_level | default: 2 -%}
|
{%- assign heading_level = site.search.heading_level | default: 2 -%}
|
||||||
@ -14,7 +23,7 @@ permalink: /assets/js/search-data.json
|
|||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
{%- assign parts = page_content | split: '<h1' -%}
|
{%- assign parts = page_content | split: '<h1' -%}
|
||||||
{%- assign title_found = false -%}
|
{%- assign title_found = false -%}
|
||||||
{% for part in parts offset: 1 %}
|
{%- for part in parts offset: 1 -%}
|
||||||
{%- assign titleAndContent = part | split: '</h1>' -%}
|
{%- assign titleAndContent = part | split: '</h1>' -%}
|
||||||
{%- assign title = titleAndContent[0] | replace_first: '>', '<h1>' | split: '<h1>' -%}
|
{%- assign title = titleAndContent[0] | replace_first: '>', '<h1>' | split: '<h1>' -%}
|
||||||
{%- assign title = title[1] | strip_html -%}
|
{%- assign title = title[1] | strip_html -%}
|
||||||
@ -54,5 +63,6 @@ permalink: /assets/js/search-data.json
|
|||||||
{%- assign i = i | plus: 1 -%}
|
{%- assign i = i | plus: 1 -%}
|
||||||
{%- endunless -%}
|
{%- endunless -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{% endfor %}
|
{%- endfor -%}
|
||||||
|
{%- endfor %}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user