mirror of
https://github.com/thangisme/notes.git
synced 2024-09-20 04:16:14 -04:00
Added doc collections and categories
This commit is contained in:
parent
654da0a6ef
commit
93f93f48a7
@ -1,6 +1,6 @@
|
||||
<ul class="nav-list">
|
||||
{%- assign ordered_pages_list = site.html_pages | where_exp:"item", "item.nav_order != nil" -%}
|
||||
{%- assign unordered_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 = include.pages | where_exp:"item", "item.nav_order == nil" -%}
|
||||
{%- if site.nav_sort == 'case_insensitive' -%}
|
||||
{%- assign sorted_ordered_pages_list = ordered_pages_list | sort_natural:"nav_order" -%}
|
||||
{%- assign sorted_unordered_pages_list = unordered_pages_list | sort_natural:"title" -%}
|
||||
|
@ -48,7 +48,19 @@ layout: table_wrappers
|
||||
</a>
|
||||
</div>
|
||||
<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>
|
||||
<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.
|
||||
|
@ -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 {
|
||||
|
@ -2,8 +2,17 @@
|
||||
permalink: /assets/js/search-data.json
|
||||
---
|
||||
{
|
||||
{%- assign i = 0 -%}
|
||||
{% for page in site.html_pages %}
|
||||
{% assign i = 0 -%}
|
||||
{%- 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 -%}
|
||||
{%- assign page_content = page.content -%}
|
||||
{%- assign heading_level = site.search.heading_level | default: 2 -%}
|
||||
@ -14,7 +23,7 @@ permalink: /assets/js/search-data.json
|
||||
{%- endfor -%}
|
||||
{%- assign parts = page_content | split: '<h1' -%}
|
||||
{%- assign title_found = false -%}
|
||||
{% for part in parts offset: 1 %}
|
||||
{%- for part in parts offset: 1 -%}
|
||||
{%- assign titleAndContent = part | split: '</h1>' -%}
|
||||
{%- assign title = titleAndContent[0] | replace_first: '>', '<h1>' | split: '<h1>' -%}
|
||||
{%- assign title = title[1] | strip_html -%}
|
||||
@ -54,5 +63,6 @@ permalink: /assets/js/search-data.json
|
||||
{%- assign i = i | plus: 1 -%}
|
||||
{%- endunless -%}
|
||||
{%- endif -%}
|
||||
{% endfor %}
|
||||
{%- endfor -%}
|
||||
{%- endfor %}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user