jekyll-awesome-nav 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92223e2c3e03f661381ed950b514da942c9ce18ddc97b5a51e1ffd3536971efa
4
- data.tar.gz: a12d8cc9e0500e4deb65803b8ad1bd94cfa88f291b452f21edceb9fd16016c32
3
+ metadata.gz: 2cfc859de2a4762ba5046338aa7bc12049da70bfb2d9ac27d727eace95322f11
4
+ data.tar.gz: 0f14a593b81ec5882b65db61b82e93d8bd8f9a3656a8d730cd0f4175a2da65e3
5
5
  SHA512:
6
- metadata.gz: e9fdc037fed9c4fa24186e83047cb98a6ed0bd36e313163d9cc6b8ae87b02bfe07225e6bd1180c502ab437c0764242c78de8ae5bcef5558d29ad2ede34951f88
7
- data.tar.gz: 0f973ac341990dc4dfebb041621e8e90e8ab3650d3ea701a4e87bcf8e94a276d360a44af9699306d768cb64810ef1fa74a9a67f8bbcb7716894d82894664b2f2
6
+ metadata.gz: 39eccdb01ce4ecd9c828f2c66b6997b6ef769ec199ffb6a94a206fa6f449c615f84edf7928290029adde02b97bdc24a9050ae70654047915181c26bd81c72a49
7
+ data.tar.gz: '008767e37db8c06b2b2c77ffa4a1cc9f437653a33684a90994d7e7da854b836b5c39687ed3065d0adcd1e6692f757a1e9346cec259e85725d5853495112f33bb'
@@ -1,5 +1,5 @@
1
1
  # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2
- _commit: 467877a
2
+ _commit: afa589e
3
3
  _src_path: gh:athackst/ci
4
4
  automerge_mode: poll
5
5
  bump_script_path: ''
@@ -75,7 +75,10 @@ module Jekyll
75
75
  end
76
76
 
77
77
  def same_dir_wrapper?(items, current_dir)
78
- items.length == 1 && items.first.section? && Utils.normalize_dir(items.first.dir) == current_dir
78
+ items.length == 1 &&
79
+ items.first.section? &&
80
+ !items.first.dir.nil? &&
81
+ Utils.normalize_dir(items.first.dir) == current_dir
79
82
  end
80
83
 
81
84
  def raw_same_dir_wrapper?(current_dir)
@@ -415,7 +418,9 @@ module Jekyll
415
418
 
416
419
  normalized = Utils.normalize_dir(candidate)
417
420
  root_index_path = Utils.normalize_dir(File.join(@root_dir, "index.md"))
418
- return nil unless [@root_dir, root_index_path, "index.md"].include?(normalized)
421
+ root_readme_path = Utils.normalize_dir(File.join(@root_dir, "README.md"))
422
+ root_readme_lower_path = Utils.normalize_dir(File.join(@root_dir, "readme.md"))
423
+ return nil unless [@root_dir, root_index_path, "index.md", root_readme_path, root_readme_lower_path].include?(normalized)
419
424
 
420
425
  Node.page(
421
426
  dir: @root_dir,
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Jekyll
4
4
  module AwesomeNav
5
- VERSION = "0.1.1"
5
+ VERSION = "0.1.2"
6
6
 
7
7
  def self.warn_if_unstamped_version(output = $stderr)
8
8
  return unless VERSION == "0.0.0"
@@ -3,5 +3,6 @@ nav:
3
3
  - Install Guide: install.md
4
4
  - Layout Integration: layouts.md
5
5
  - Configuration: config.md
6
+ - .nav.yml Reference: nav-file.md
6
7
  - Navigation Overrides: overrides.md
7
8
  - Generated Data: data.md
@@ -11,5 +11,6 @@ The `docs/guides/.nav.yml` file replaces this subtree, which means the guides ca
11
11
  - [Install Guide]({{ "/docs/guides/install/" | relative_url }})
12
12
  - [Layout Integration]({{ "/docs/guides/layouts/" | relative_url }})
13
13
  - [Configuration]({{ "/docs/guides/config/" | relative_url }})
14
+ - [.nav.yml Reference]({{ "/docs/guides/nav-file/" | relative_url }})
14
15
  - [Navigation Overrides]({{ "/docs/guides/overrides/" | relative_url }})
15
16
  - [Generated Data]({{ "/docs/guides/data/" | relative_url }})
@@ -0,0 +1,260 @@
1
+ ---
2
+ title: .nav.yml Reference
3
+ ---
4
+
5
+ `.nav.yml` lets a directory replace its generated navigation subtree with a hand-authored one.
6
+
7
+ Put the file in the directory you want to control:
8
+
9
+ ```text
10
+ docs/
11
+ guides/
12
+ .nav.yml
13
+ index.md
14
+ install.md
15
+ config.md
16
+ ```
17
+
18
+ The override applies only to that directory subtree. Parent sections and sibling sections keep using their own generated or overridden navigation.
19
+
20
+ ## Minimal file
21
+
22
+ The smallest useful `.nav.yml` defines a `nav:` array:
23
+
24
+ ```yaml
25
+ nav:
26
+ - Guides Home: index.md
27
+ - Install: install.md
28
+ - Configuration: config.md
29
+ ```
30
+
31
+ Each item is either:
32
+
33
+ - a string path like `install.md`
34
+ - a titled path mapping like `Install: install.md`
35
+ - a titled section with nested children
36
+ - a glob entry such as `"*.md"`
37
+
38
+ ## Top-level options
39
+
40
+ These keys are supported at the top level of `.nav.yml`:
41
+
42
+ | Option | Type | Description |
43
+ | --- | --- | --- |
44
+ | `nav` | array | Manual nav entries for this directory. |
45
+ | `append_unmatched` | boolean | Appends generated items that were not matched by `nav`. |
46
+ | `ignore` | string or array | Excludes generated items from globs and `append_unmatched`. |
47
+ | `sort` | mapping | Sorts generated batches from globs and `append_unmatched`. |
48
+ | `hide` | boolean | Hides this directory from generated nav, manual directory references, and child nav processing. |
49
+
50
+ Options-only files are valid, so this works when you only want to hide a directory:
51
+
52
+ ```yaml
53
+ hide: true
54
+ ```
55
+
56
+ ## `nav` items
57
+
58
+ ### String paths
59
+
60
+ Use a string when you want the generated page or section title:
61
+
62
+ ```yaml
63
+ nav:
64
+ - index.md
65
+ - install.md
66
+ - guides
67
+ ```
68
+
69
+ - File paths insert a page.
70
+ - Directory paths insert that directory's generated section.
71
+ - External URLs are allowed and stay as-is.
72
+
73
+ ### Titled paths
74
+
75
+ Use a mapping to rename an item in navigation:
76
+
77
+ ```yaml
78
+ nav:
79
+ - Guides Hub: index.md
80
+ - Install Guide: install.md
81
+ - Project Website: https://example.com
82
+ ```
83
+
84
+ ### Manual sections
85
+
86
+ Use a titled list to create a group:
87
+
88
+ ```yaml
89
+ nav:
90
+ - Main:
91
+ - getting-started.md
92
+ - Guides: guides
93
+ - More:
94
+ - API Reference: ../reference.md
95
+ - Project Website: https://example.com
96
+ ```
97
+
98
+ Manual sections are grouping nodes. They do not get their own URL unless you point them at a page instead of a child list.
99
+
100
+ ## Path resolution
101
+
102
+ Paths are resolved in this order:
103
+
104
+ 1. Relative to the directory that contains the `.nav.yml`
105
+ 2. Relative to `awesome_nav.root`
106
+
107
+ That means a file in `docs/guides/.nav.yml` can usually use short local paths like `install.md`, while a shared page can still be referenced from the root, such as `reference.md`.
108
+
109
+ ## Globs
110
+
111
+ Globs pull in generated items without listing each one manually:
112
+
113
+ ```yaml
114
+ nav:
115
+ - getting-started.md
116
+ - "*.md"
117
+ - "*/"
118
+ - "archive/**/*.md"
119
+ ```
120
+
121
+ Useful patterns:
122
+
123
+ - `"*.md"` matches pages in the current directory
124
+ - `"*/"` matches child sections only
125
+ - `"**/*.md"` matches pages recursively
126
+
127
+ Recursive globs insert matches as a flat list at that position. They do not preserve nested folder structure.
128
+
129
+ You can also write a glob entry explicitly:
130
+
131
+ ```yaml
132
+ nav:
133
+ - glob: "*.md"
134
+ ```
135
+
136
+ ## `append_unmatched`
137
+
138
+ By default, a manual `nav:` array is a complete replacement for the local generated subtree. Items you leave out stay out.
139
+
140
+ Set `append_unmatched: true` when you want to hand-place a few items and then append the rest of the generated local items afterward:
141
+
142
+ ```yaml
143
+ append_unmatched: true
144
+ nav:
145
+ - getting-started.md
146
+ - guides
147
+ ```
148
+
149
+ Child `.nav.yml` files inherit the nearest parent `append_unmatched` setting unless they set their own value.
150
+
151
+ ## `ignore`
152
+
153
+ `ignore` filters generated items from:
154
+
155
+ - glob matches
156
+ - appended unmatched items
157
+
158
+ It does not block a page you list explicitly in `nav:`.
159
+
160
+ ```yaml
161
+ ignore:
162
+ - "*.hidden.md"
163
+ - "drafts/"
164
+ nav:
165
+ - visible.md
166
+ - "*.md"
167
+ ```
168
+
169
+ Here, `visible.md` still appears even if it also matches an ignore pattern, because it was added manually.
170
+
171
+ ## `sort`
172
+
173
+ `sort` controls the order of generated batches only:
174
+
175
+ - glob expansions
176
+ - `append_unmatched` output
177
+
178
+ Manual entries stay in the exact order you wrote them.
179
+
180
+ ```yaml
181
+ sort:
182
+ direction: desc
183
+ type: natural
184
+ by: filename
185
+ sections: last
186
+ ignore_case: true
187
+ nav:
188
+ - intro.md
189
+ - "*.md"
190
+ ```
191
+
192
+ Supported sort fields:
193
+
194
+ | Key | Values | Default |
195
+ | --- | --- | --- |
196
+ | `direction` | `asc`, `desc` | `asc` |
197
+ | `type` | `alphabetical`, `natural` | `alphabetical` |
198
+ | `by` | `path`, `filename`, `title` | `path` |
199
+ | `sections` | `first`, `last` | `first` |
200
+ | `ignore_case` | `true`, `false` | `true` |
201
+
202
+ Per-glob sort settings are not supported. Sorting is configured once for the whole file.
203
+
204
+ ## `hide`
205
+
206
+ Use `hide: true` in a directory's own `.nav.yml` when that subtree should disappear from navigation entirely:
207
+
208
+ ```yaml
209
+ hide: true
210
+ ```
211
+
212
+ When a directory is hidden:
213
+
214
+ - it is skipped in generated navigation
215
+ - manual references to that directory do not insert it
216
+ - child `.nav.yml` files under that directory are not used
217
+
218
+ ## Common patterns
219
+
220
+ ### Curated local section
221
+
222
+ ```yaml
223
+ nav:
224
+ - Guides Home: index.md
225
+ - Install: install.md
226
+ - Configuration: config.md
227
+ ```
228
+
229
+ ### Manual intro, generated remainder
230
+
231
+ ```yaml
232
+ append_unmatched: true
233
+ nav:
234
+ - index.md
235
+ - getting-started.md
236
+ ```
237
+
238
+ ### Rename a section and include its generated children
239
+
240
+ ```yaml
241
+ nav:
242
+ - User Guides: guides
243
+ ```
244
+
245
+ ### Group links under headings
246
+
247
+ ```yaml
248
+ nav:
249
+ - Learn:
250
+ - getting-started.md
251
+ - guides
252
+ - External:
253
+ - API Docs: https://example.com/api
254
+ ```
255
+
256
+ ## Notes
257
+
258
+ - `.nav.yml` replaces the local subtree. It does not merge with generated items unless you opt into `append_unmatched`.
259
+ - Duplicate items are automatically deduplicated when a manual entry and a glob point at the same generated source.
260
+ - Paths must resolve to pages or directories already known to Jekyll under the configured root.
@@ -22,6 +22,8 @@ Use `.nav.yml` when a section needs:
22
22
  - shorter or clearer labels
23
23
  - links that do not map one-to-one with filenames
24
24
  - a curated subset of pages
25
+ - generated batches mixed with manual items
26
+ - hidden sections or filtered globs
25
27
 
26
28
  ## What gets replaced
27
29
 
@@ -40,3 +42,15 @@ nav:
40
42
  ```
41
43
 
42
44
  Use Markdown source paths. The plugin resolves them through Jekyll pages and then uses the final page URL.
45
+
46
+ ## More options
47
+
48
+ `.nav.yml` also supports:
49
+
50
+ - glob entries like `"*.md"` and `"*/"`
51
+ - `append_unmatched: true` to append generated items you did not list manually
52
+ - `ignore:` to filter generated matches
53
+ - `sort:` to order generated batches
54
+ - `hide: true` to remove a subtree entirely
55
+
56
+ The full syntax and option reference lives in [.nav.yml Reference]({{ "/docs/guides/nav-file/" | relative_url }}).
data/site/docs/index.md CHANGED
@@ -11,6 +11,7 @@ The plugin does not require collections. It reads pages under the configured `aw
11
11
  - [Getting Started]({{ "/docs/getting-started/" | relative_url }}) shows the minimum install and config.
12
12
  - [Layout Integration]({{ "/docs/guides/layouts/" | relative_url }}) shows how to render sidebars, breadcrumbs, and previous/next links.
13
13
  - [Configuration]({{ "/docs/guides/config/" | relative_url }}) explains the available plugin settings.
14
+ - [.nav.yml Reference]({{ "/docs/guides/nav-file/" | relative_url }}) documents override syntax, options, and common patterns.
14
15
  - [Navigation Overrides]({{ "/docs/guides/overrides/" | relative_url }}) shows how local `.nav.yml` files customize sections.
15
16
  - [Generated Data]({{ "/docs/guides/data/" | relative_url }}) lists the page variables available to themes and layouts.
16
17
 
@@ -26,6 +27,7 @@ docs/
26
27
  ├── index.md
27
28
  ├── install.md
28
29
  ├── layouts.md
30
+ ├── nav-file.md
29
31
  ├── overrides.md
30
32
  ├── data.md
31
33
  ├── config.md
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-awesome-nav
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Allison Thackston
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-05-11 00:00:00.000000000 Z
11
+ date: 2026-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -76,6 +76,7 @@ files:
76
76
  - site/docs/guides/index.md
77
77
  - site/docs/guides/install.md
78
78
  - site/docs/guides/layouts.md
79
+ - site/docs/guides/nav-file.md
79
80
  - site/docs/guides/overrides.md
80
81
  - site/docs/index.md
81
82
  - site/index.md