jekyll-awesome-nav 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.copier-answers.ci.yml +12 -0
- data/.devcontainer/devcontainer.json +35 -0
- data/.devcontainer/post-create.sh +19 -0
- data/.rubocop.yml +43 -0
- data/.ruby-version +1 -0
- data/.vscode/tasks.json +70 -0
- data/AGENTS.md +287 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/LICENSE.txt +21 -0
- data/README.md +176 -0
- data/Rakefile +11 -0
- data/jekyll-awesome-nav.gemspec +35 -0
- data/lib/jekyll/awesome_nav/config.rb +31 -0
- data/lib/jekyll/awesome_nav/generator.rb +50 -0
- data/lib/jekyll/awesome_nav/nav_file.rb +14 -0
- data/lib/jekyll/awesome_nav/nav_file_loader.rb +140 -0
- data/lib/jekyll/awesome_nav/nav_file_options.rb +69 -0
- data/lib/jekyll/awesome_nav/nav_resolver.rb +370 -0
- data/lib/jekyll/awesome_nav/navigation_result.rb +150 -0
- data/lib/jekyll/awesome_nav/node.rb +64 -0
- data/lib/jekyll/awesome_nav/page_set.rb +31 -0
- data/lib/jekyll/awesome_nav/serializer.rb +26 -0
- data/lib/jekyll/awesome_nav/sort_options.rb +91 -0
- data/lib/jekyll/awesome_nav/tree_builder.rb +75 -0
- data/lib/jekyll/awesome_nav/utils.rb +94 -0
- data/lib/jekyll/awesome_nav/version.rb +19 -0
- data/lib/jekyll/awesome_nav.rb +26 -0
- data/lib/jekyll-awesome-nav.rb +3 -0
- data/site/_config.yml +33 -0
- data/site/_includes/awesome-nav-demo-tree.html +15 -0
- data/site/_includes/awesome-nav-tree.html +19 -0
- data/site/_layouts/awesome_nav_demo.html +128 -0
- data/site/docs/getting-started.md +68 -0
- data/site/docs/guides/.nav.yml +7 -0
- data/site/docs/guides/config.md +37 -0
- data/site/docs/guides/data.md +40 -0
- data/site/docs/guides/index.md +15 -0
- data/site/docs/guides/install.md +53 -0
- data/site/docs/guides/layouts.md +116 -0
- data/site/docs/guides/overrides.md +42 -0
- data/site/docs/index.md +35 -0
- data/site/index.md +66 -0
- metadata +111 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Install
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
This page appears under the overridden guides subtree.
|
|
6
|
+
|
|
7
|
+
## Gemfile
|
|
8
|
+
|
|
9
|
+
Add the plugin to your site's `Gemfile`:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem "jekyll-awesome-nav"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
If you use a `:jekyll_plugins` group, it is fine to place it there:
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
group :jekyll_plugins do
|
|
19
|
+
gem "jekyll-awesome-nav"
|
|
20
|
+
end
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Jekyll config
|
|
24
|
+
|
|
25
|
+
Add the plugin to `_config.yml`:
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
plugins:
|
|
29
|
+
- jekyll-awesome-nav
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Then configure the docs root:
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
awesome_nav:
|
|
36
|
+
enabled: true
|
|
37
|
+
root: docs
|
|
38
|
+
nav_filename: .nav.yml
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Layout default
|
|
42
|
+
|
|
43
|
+
Set a layout for the docs folder so every generated page receives the same navigation UI:
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
defaults:
|
|
47
|
+
- scope:
|
|
48
|
+
path: "docs"
|
|
49
|
+
values:
|
|
50
|
+
layout: docs
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The plugin generates the data. The layout decides how that data looks.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Layout Integration
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
`jekyll-awesome-nav` generates navigation data. Your layout renders it.
|
|
6
|
+
|
|
7
|
+
This site uses its own small layout at `site/_layouts/docs.html`, with a recursive include at `site/_includes/awesome-nav-tree.html`.
|
|
8
|
+
|
|
9
|
+
You can use those files as a starting point when wiring the same data into another Jekyll theme.
|
|
10
|
+
|
|
11
|
+
## Enable a docs layout
|
|
12
|
+
|
|
13
|
+
Set a layout for every page under your docs root:
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
defaults:
|
|
17
|
+
- scope:
|
|
18
|
+
path: "docs"
|
|
19
|
+
values:
|
|
20
|
+
layout: docs
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Inside that layout, check for generated navigation before rendering plugin-specific UI:
|
|
24
|
+
|
|
25
|
+
```liquid
|
|
26
|
+
{% raw %}{% if page.awesome_nav %}
|
|
27
|
+
<!-- Render awesome nav UI -->
|
|
28
|
+
{% endif %}{% endraw %}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Render breadcrumbs
|
|
32
|
+
|
|
33
|
+
The plugin writes breadcrumbs to `page.breadcrumbs`.
|
|
34
|
+
|
|
35
|
+
```liquid
|
|
36
|
+
{% raw %}{% if page.breadcrumbs %}
|
|
37
|
+
<nav aria-label="Breadcrumbs">
|
|
38
|
+
<ol>
|
|
39
|
+
{% for item in page.breadcrumbs %}
|
|
40
|
+
<li><a href="{{ item.url | relative_url }}">{{ item.title }}</a></li>
|
|
41
|
+
{% endfor %}
|
|
42
|
+
</ol>
|
|
43
|
+
</nav>
|
|
44
|
+
{% endif %}{% endraw %}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Render a sidebar
|
|
48
|
+
|
|
49
|
+
Use `page.awesome_nav` for the full docs tree:
|
|
50
|
+
|
|
51
|
+
```liquid
|
|
52
|
+
{% raw %}<nav aria-label="Documentation">
|
|
53
|
+
<ul>
|
|
54
|
+
{% for item in page.awesome_nav %}
|
|
55
|
+
<li>
|
|
56
|
+
<a href="{{ item.url | relative_url }}">{{ item.title }}</a>
|
|
57
|
+
{% if item.children %}
|
|
58
|
+
<ul>
|
|
59
|
+
{% for child in item.children %}
|
|
60
|
+
<li><a href="{{ child.url | relative_url }}">{{ child.title }}</a></li>
|
|
61
|
+
{% endfor %}
|
|
62
|
+
</ul>
|
|
63
|
+
{% endif %}
|
|
64
|
+
</li>
|
|
65
|
+
{% endfor %}
|
|
66
|
+
</ul>
|
|
67
|
+
</nav>{% endraw %}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
For deeply nested docs, move the recursive portion into an include and call it for each `children` collection.
|
|
71
|
+
|
|
72
|
+
## Render the current section
|
|
73
|
+
|
|
74
|
+
Use `page.awesome_nav_local` when you want a compact menu for the current directory:
|
|
75
|
+
|
|
76
|
+
```liquid
|
|
77
|
+
{% raw %}{% if page.awesome_nav_local %}
|
|
78
|
+
<nav aria-label="This section">
|
|
79
|
+
<ul>
|
|
80
|
+
{% for item in page.awesome_nav_local %}
|
|
81
|
+
<li><a href="{{ item.url | relative_url }}">{{ item.title }}</a></li>
|
|
82
|
+
{% endfor %}
|
|
83
|
+
</ul>
|
|
84
|
+
</nav>
|
|
85
|
+
{% endif %}{% endraw %}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Render previous and next links
|
|
89
|
+
|
|
90
|
+
The plugin calculates previous and next pages from the final resolved tree, including local `.nav.yml` overrides.
|
|
91
|
+
|
|
92
|
+
```liquid
|
|
93
|
+
{% raw %}<nav aria-label="Pagination">
|
|
94
|
+
{% if page.awesome_nav_previous %}
|
|
95
|
+
<a href="{{ page.awesome_nav_previous.url | relative_url }}">
|
|
96
|
+
Previous: {{ page.awesome_nav_previous.title }}
|
|
97
|
+
</a>
|
|
98
|
+
{% endif %}
|
|
99
|
+
|
|
100
|
+
{% if page.awesome_nav_next %}
|
|
101
|
+
<a href="{{ page.awesome_nav_next.url | relative_url }}">
|
|
102
|
+
Next: {{ page.awesome_nav_next.title }}
|
|
103
|
+
</a>
|
|
104
|
+
{% endif %}
|
|
105
|
+
</nav>{% endraw %}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Theme includes
|
|
109
|
+
|
|
110
|
+
If you maintain a theme, a clean pattern is:
|
|
111
|
+
|
|
112
|
+
- one include for breadcrumbs
|
|
113
|
+
- one recursive include for tree rendering
|
|
114
|
+
- one layout that chooses full-tree or local-section navigation
|
|
115
|
+
|
|
116
|
+
That keeps the plugin data plain and lets the theme own the HTML and CSS.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Navigation Overrides
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
By default, the plugin builds navigation from files and folders. A local `.nav.yml` lets a folder replace its own subtree.
|
|
6
|
+
|
|
7
|
+
This demo has an override at `docs/guides/.nav.yml`:
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
nav:
|
|
11
|
+
- Guides Hub: index.md
|
|
12
|
+
- Install Guide: install.md
|
|
13
|
+
- Layout Integration: layouts.md
|
|
14
|
+
- Configuration: config.md
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## When to use an override
|
|
18
|
+
|
|
19
|
+
Use `.nav.yml` when a section needs:
|
|
20
|
+
|
|
21
|
+
- a custom order
|
|
22
|
+
- shorter or clearer labels
|
|
23
|
+
- links that do not map one-to-one with filenames
|
|
24
|
+
- a curated subset of pages
|
|
25
|
+
|
|
26
|
+
## What gets replaced
|
|
27
|
+
|
|
28
|
+
An override replaces the subtree for the directory where it appears. Other directories still use generated navigation.
|
|
29
|
+
|
|
30
|
+
For example, `docs/guides/.nav.yml` controls the guides section only. The root `docs/` tree is still generated from the folder structure and then uses the guides override for that branch.
|
|
31
|
+
|
|
32
|
+
## Link format
|
|
33
|
+
|
|
34
|
+
Each item uses a `Title: path.md` entry. Nested sections use a list:
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
nav:
|
|
38
|
+
- Section:
|
|
39
|
+
- Page: section/page.md
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Use Markdown source paths. The plugin resolves them through Jekyll pages and then uses the final page URL.
|
data/site/docs/index.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Documentation
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
These docs show how `jekyll-awesome-nav` turns a normal folder of Markdown files into navigation data your layouts can render.
|
|
6
|
+
|
|
7
|
+
The plugin does not require collections. It reads pages under the configured `awesome_nav.root`, builds a tree, and writes the result onto each docs page.
|
|
8
|
+
|
|
9
|
+
## Start here
|
|
10
|
+
|
|
11
|
+
- [Getting Started]({{ "/docs/getting-started/" | relative_url }}) shows the minimum install and config.
|
|
12
|
+
- [Layout Integration]({{ "/docs/guides/layouts/" | relative_url }}) shows how to render sidebars, breadcrumbs, and previous/next links.
|
|
13
|
+
- [Configuration]({{ "/docs/guides/config/" | relative_url }}) explains the available plugin settings.
|
|
14
|
+
- [Navigation Overrides]({{ "/docs/guides/overrides/" | relative_url }}) shows how local `.nav.yml` files customize sections.
|
|
15
|
+
- [Generated Data]({{ "/docs/guides/data/" | relative_url }}) lists the page variables available to themes and layouts.
|
|
16
|
+
|
|
17
|
+
## Folder shape
|
|
18
|
+
|
|
19
|
+
This documentation site uses a plain `docs/` folder:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
docs/
|
|
23
|
+
├── index.md
|
|
24
|
+
├── getting-started.md
|
|
25
|
+
└── guides/
|
|
26
|
+
├── index.md
|
|
27
|
+
├── install.md
|
|
28
|
+
├── layouts.md
|
|
29
|
+
├── overrides.md
|
|
30
|
+
├── data.md
|
|
31
|
+
├── config.md
|
|
32
|
+
└── .nav.yml
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Pages are included in the generated tree when they live under `awesome_nav.root`. A folder can provide an `index.md` page to represent the section itself.
|
data/site/index.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: profile
|
|
3
|
+
title: Jekyll Awesome Nav
|
|
4
|
+
permalink: /
|
|
5
|
+
links:
|
|
6
|
+
- name: Browse the docs
|
|
7
|
+
url: /docs/
|
|
8
|
+
octicon: file
|
|
9
|
+
- name: Install the gem
|
|
10
|
+
url: /docs/getting-started/
|
|
11
|
+
octicon: package
|
|
12
|
+
- name: View the source
|
|
13
|
+
url: https://github.com/PrimerPages/jekyll-awesome-nav
|
|
14
|
+
octicon: mark-github
|
|
15
|
+
- name: Read the README
|
|
16
|
+
url: https://github.com/PrimerPages/jekyll-awesome-nav/blob/main/README.md
|
|
17
|
+
octicon: book
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# Folder-based docs navigation for Jekyll
|
|
21
|
+
|
|
22
|
+
`jekyll-awesome-nav` builds a full navigation tree from your docs folder and lets any directory replace its own subtree with a local `.nav.yml` file.
|
|
23
|
+
|
|
24
|
+
It is designed for documentation sites that want sensible defaults from folder structure, while still giving authors precise local control when a section needs a custom order or grouping.
|
|
25
|
+
|
|
26
|
+
## What it does
|
|
27
|
+
|
|
28
|
+
- Builds navigation from `site.pages` under one configured root such as `docs/`
|
|
29
|
+
- Uses `index.md` as the section title and section URL
|
|
30
|
+
- Exposes the full tree on every page as `page.awesome_nav`
|
|
31
|
+
- Exposes the current directory subtree as `page.awesome_nav_local`
|
|
32
|
+
- Computes breadcrumbs from the final resolved tree
|
|
33
|
+
- Replaces a directory subtree entirely when `.nav.yml` is present
|
|
34
|
+
|
|
35
|
+
## Quick start
|
|
36
|
+
|
|
37
|
+
Add the gem to your site:
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
gem "jekyll-awesome-nav"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Enable it in `_config.yml`:
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
plugins:
|
|
47
|
+
- jekyll-awesome-nav
|
|
48
|
+
|
|
49
|
+
awesome_nav:
|
|
50
|
+
enabled: true
|
|
51
|
+
root: docs
|
|
52
|
+
nav_filename: .nav.yml
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Then create docs pages under `docs/`. If you want a section to use a custom structure, add a local `.nav.yml` in that folder.
|
|
56
|
+
|
|
57
|
+
## This site
|
|
58
|
+
|
|
59
|
+
This site is the plugin documentation source. The docs section demonstrates:
|
|
60
|
+
|
|
61
|
+
- automatically generated navigation
|
|
62
|
+
- a local `.nav.yml` override in `docs/guides/`
|
|
63
|
+
- glob expansion and generated-batch options
|
|
64
|
+
- breadcrumb generation
|
|
65
|
+
- per-page `awesome_nav` data for theme rendering
|
|
66
|
+
|
metadata
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: jekyll-awesome-nav
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Allison Thackston
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-05-06 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: jekyll
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '3.9'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '5.0'
|
|
23
|
+
type: :runtime
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '3.9'
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '5.0'
|
|
33
|
+
description: Build a full navigation tree from a docs directory and let any folder
|
|
34
|
+
replace its subtree with a local _nav.yml file.
|
|
35
|
+
email:
|
|
36
|
+
- allison@allisonthackston.com
|
|
37
|
+
executables: []
|
|
38
|
+
extensions: []
|
|
39
|
+
extra_rdoc_files: []
|
|
40
|
+
files:
|
|
41
|
+
- ".copier-answers.ci.yml"
|
|
42
|
+
- ".devcontainer/devcontainer.json"
|
|
43
|
+
- ".devcontainer/post-create.sh"
|
|
44
|
+
- ".rubocop.yml"
|
|
45
|
+
- ".ruby-version"
|
|
46
|
+
- ".vscode/tasks.json"
|
|
47
|
+
- AGENTS.md
|
|
48
|
+
- CODE_OF_CONDUCT.md
|
|
49
|
+
- LICENSE.txt
|
|
50
|
+
- README.md
|
|
51
|
+
- Rakefile
|
|
52
|
+
- jekyll-awesome-nav.gemspec
|
|
53
|
+
- lib/jekyll-awesome-nav.rb
|
|
54
|
+
- lib/jekyll/awesome_nav.rb
|
|
55
|
+
- lib/jekyll/awesome_nav/config.rb
|
|
56
|
+
- lib/jekyll/awesome_nav/generator.rb
|
|
57
|
+
- lib/jekyll/awesome_nav/nav_file.rb
|
|
58
|
+
- lib/jekyll/awesome_nav/nav_file_loader.rb
|
|
59
|
+
- lib/jekyll/awesome_nav/nav_file_options.rb
|
|
60
|
+
- lib/jekyll/awesome_nav/nav_resolver.rb
|
|
61
|
+
- lib/jekyll/awesome_nav/navigation_result.rb
|
|
62
|
+
- lib/jekyll/awesome_nav/node.rb
|
|
63
|
+
- lib/jekyll/awesome_nav/page_set.rb
|
|
64
|
+
- lib/jekyll/awesome_nav/serializer.rb
|
|
65
|
+
- lib/jekyll/awesome_nav/sort_options.rb
|
|
66
|
+
- lib/jekyll/awesome_nav/tree_builder.rb
|
|
67
|
+
- lib/jekyll/awesome_nav/utils.rb
|
|
68
|
+
- lib/jekyll/awesome_nav/version.rb
|
|
69
|
+
- site/_config.yml
|
|
70
|
+
- site/_includes/awesome-nav-demo-tree.html
|
|
71
|
+
- site/_includes/awesome-nav-tree.html
|
|
72
|
+
- site/_layouts/awesome_nav_demo.html
|
|
73
|
+
- site/docs/getting-started.md
|
|
74
|
+
- site/docs/guides/.nav.yml
|
|
75
|
+
- site/docs/guides/config.md
|
|
76
|
+
- site/docs/guides/data.md
|
|
77
|
+
- site/docs/guides/index.md
|
|
78
|
+
- site/docs/guides/install.md
|
|
79
|
+
- site/docs/guides/layouts.md
|
|
80
|
+
- site/docs/guides/overrides.md
|
|
81
|
+
- site/docs/index.md
|
|
82
|
+
- site/index.md
|
|
83
|
+
homepage: https://github.com/PrimerPages/jekyll-awesome-nav
|
|
84
|
+
licenses:
|
|
85
|
+
- MIT
|
|
86
|
+
metadata:
|
|
87
|
+
homepage_uri: https://github.com/PrimerPages/jekyll-awesome-nav
|
|
88
|
+
source_code_uri: https://github.com/PrimerPages/jekyll-awesome-nav
|
|
89
|
+
bug_tracker_uri: https://github.com/PrimerPages/jekyll-awesome-nav/issues
|
|
90
|
+
documentation_uri: https://primerpages.github.io/jekyll-awesome-nav/
|
|
91
|
+
rubygems_mfa_required: 'true'
|
|
92
|
+
post_install_message:
|
|
93
|
+
rdoc_options: []
|
|
94
|
+
require_paths:
|
|
95
|
+
- lib
|
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
|
+
requirements:
|
|
98
|
+
- - ">="
|
|
99
|
+
- !ruby/object:Gem::Version
|
|
100
|
+
version: 2.7.0
|
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
|
+
requirements:
|
|
103
|
+
- - ">="
|
|
104
|
+
- !ruby/object:Gem::Version
|
|
105
|
+
version: '0'
|
|
106
|
+
requirements: []
|
|
107
|
+
rubygems_version: 3.5.11
|
|
108
|
+
signing_key:
|
|
109
|
+
specification_version: 4
|
|
110
|
+
summary: Folder-based navigation for Jekyll with local subtree overrides.
|
|
111
|
+
test_files: []
|