jekyll-theme-flow 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1807cdc544f131cc5fba45fd9e7647632b11885da1622ab37bf741c11f0f240e
4
- data.tar.gz: 9118dd79f3c32205a91ae8e98a3274b2cd30a3c9678393f013074b692976c139
3
+ metadata.gz: 83d046ce0329b79d59e06149cf707d9a597b9e0ce7ab84788e562d7b1daa028d
4
+ data.tar.gz: 99d8b62f25deb6a9df4b67ddb1632357f195125886ef2d5a6a43799bcbf5f031
5
5
  SHA512:
6
- metadata.gz: 556614a6d2e114ceb5821b6758cfd7fc3bb15566bdeccf1475d45e336244b85e9520fe84d3c588febec280ab2462c31e22d68450e32c33a3456eb10c391b3426
7
- data.tar.gz: 565c12f444beb7344a4260fcb237fb1d106020f5342e84cd350fea2c18e5df1941d524f0b53a2c59a300f6659c891fc4309837f3c6fe35916308cdd6be719d29
6
+ metadata.gz: acafabb7a25c8d5e3b14d36700f500d74b15a880bf2dbe43c5a362fb839a8bd4ed3fd40a42aee4927c4a385cc5157d5a2c4f4f4a018dd0aa68f7accd3628451a
7
+ data.tar.gz: 2026d6511d1047a879072968c5081cf985123a2324ce08317d8ff8548488778704a694a7b0679bc43c86bc1950113763322eb2e7dc6e6cf5559783582f294bdf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,79 @@
1
1
  # Changelog
2
2
 
3
+ <!-- markdownlint-configure-file { "MD024": { "siblings_only": true } } -->
4
+
5
+ ## [0.3.1] - 2026-11-08
6
+
7
+ ### Fixed
8
+
9
+ - SonarCloud quality gate: add `lang`/`title` to `docs/assets/demo.html`
10
+ and a `//NOSONAR` marker on `_includes/head.html` — `<title>` is
11
+ emitted by `{% seo %}`, which the web analyzer cannot expand.
12
+
13
+ ## [0.3.0] - 2026-11-08
14
+
15
+ ### Added
16
+
17
+ - `rake docs:demo` — captures the checked-in illustrative overview as
18
+ animated AVIF + WebP + static PNG (headless Chrome + ffmpeg + img2webp;
19
+ build-host tools), embedded in README via `<picture>`. Examples are
20
+ schematic, not generated from a live Jekyll build; the sequence opens
21
+ with a wireframe strip of the four layout shells.
22
+ - `rake docs:layouts` — real per-shell screenshots (sidebar-left,
23
+ sidebar-right, topnav, bare) captured from live demo builds with
24
+ headless Chrome, embedded as a gallery in the README Layouts section;
25
+ the stills are also encoded into an animated
26
+ `layout-demo.{avif,webp,png}` cycling the four shells.
27
+ - just-the-docs migration parity (all documented in README):
28
+ - `layout: home`, `page` and `post` aliases of `default`; `{% seo %}`
29
+ meta tags via the new `jekyll-seo-tag` runtime dependency; callout
30
+ classes `.note .new .important .warning .highlight` in theme CSS.
31
+ - `NavGenerator` precomputes the nav tree into
32
+ `site.data["flow_nav"]` once per build (`theme:`-only consumers
33
+ keep the Liquid fallback; `flow.nav_cache: false` opts out), with
34
+ JTD ordering — `nav_order` first, then natural title sort — and
35
+ `child_nav_order: reversed|desc|descending` on parents.
36
+ - Breadcrumbs above content (`flow.breadcrumbs` site-wide,
37
+ `breadcrumbs: false` per page) and an auto children TOC
38
+ (`flow.children_toc`, `has_children: false`, `has_toc: false`).
39
+ - `aux_links` + `aux_links_new_tab` in the topnav navbar-end and the
40
+ sidebar top bar; `nav_external_links` appended to the sidebar nav
41
+ (`title`/`url`/`opens_in_new_tab`/`hide_icon`).
42
+ - `flow.back_to_top` floating button, `flow.theme: light|dark`
43
+ `data-theme` attribute, `nav_enabled: false` → `bare` shell,
44
+ `favicon_ico:` fallback, `table_wrap` `.table-container` wrapping
45
+ and a skip-to-main link.
46
+ - Footer "Page last modified" from `last_modified_at` /
47
+ `last_modified` / `last_modified_date` front matter, controlled by
48
+ `flow.last_edit` / `flow.last_edit_format` plus the JTD aliases
49
+ `last_edit_timestamp` / `last_edit_time_format`.
50
+ - Empty include override hooks: `head_custom`, `header_custom`,
51
+ `footer_custom`, `nav_footer_custom`, `search_placeholder_custom`
52
+ and `toc_heading_custom` — site files win, matching the JTD
53
+ convention.
54
+
55
+ ### Changed
56
+
57
+ - The no-JS search form `action` now follows
58
+ `client_search.dropdown.redirect_url` instead of hardcoding
59
+ `/search/`.
60
+ - In-range gem updates: `addressable` 2.9.1 → 2.9.2, `minitest`
61
+ 6.0.6 → 6.1.0, `sass-embedded` 1.107.1 → 1.108.1;
62
+ `BUNDLED WITH` 4.0.21 → 4.0.24.
63
+ - CI: `ruby/setup-ruby` pin bumped v1.335.0 → v1.338.0.
64
+
65
+ ### Fixed
66
+
67
+ - Escape `footer_content` before rendering so config text cannot inject
68
+ HTML; use the trusted `footer_custom.html` include for markup.
69
+ - Apply `relative_url` to `nav_external_links` so local links respect
70
+ the site's `baseurl` while absolute external URLs remain unchanged.
71
+ - Give navbar burger buttons a visible "Menu" label and preserve their
72
+ four decorative bars for Bulma's burger styling.
73
+ - Mark the live-search input as a combobox and expose the results popup
74
+ as a named listbox while keeping its result list compatible with
75
+ jekyll-client-search.
76
+
3
77
  ## [0.2.0] - 2026-10-31
4
78
 
5
79
  ### Fixed
@@ -9,6 +83,9 @@
9
83
  `:pages, :post_init` to a `:site, :post_read` sweep over
10
84
  `site.pages + site.documents` (document `:post_init` fires before
11
85
  front matter is merged, so `layout: archive` was invisible there).
86
+ - Demo `_config.yml` now excludes `jekyll-theme-flow.gemspec` from
87
+ `_site` — a stale generated copy made Bundler resolve the path gem
88
+ from `_site/` instead of the repo root.
12
89
 
13
90
  ### Changed
14
91
 
@@ -23,6 +100,9 @@
23
100
  `minitest ~> 6.0`.
24
101
  - README gained an Inspiration section (just-the-docs nav model;
25
102
  planned `layout: portfolio` one-pager after jamigibbs/phantom).
103
+ - Version now lives in `lib/jekyll/theme_flow/version.rb`
104
+ (`Jekyll::ThemeFlow::VERSION`), matching the sibling-plugin
105
+ convention; `version:bump` rewrites the constant.
26
106
  - Updated vendored Bulma Sass conditional syntax to avoid deprecation
27
107
  warnings with current Sass.
28
108
  - Constrained runtime plugin dependencies to compatible version series,
data/README.md CHANGED
@@ -19,6 +19,24 @@ standard layout shells you can switch per site or per page.
19
19
  No Node toolchain required — Bulma compiles through Jekyll's own Sass
20
20
  pipeline, and Alpine is vendored into the theme.
21
21
 
22
+ <!-- markdownlint-disable MD033 -->
23
+ <picture>
24
+ <source
25
+ srcset="docs/assets/jekyll-theme-flow-demo.avif"
26
+ type="image/avif">
27
+ <source
28
+ srcset="docs/assets/jekyll-theme-flow-demo.webp"
29
+ type="image/webp">
30
+ <img src="docs/assets/jekyll-theme-flow-demo.png"
31
+ alt="jekyll-theme-flow demo">
32
+ </picture>
33
+ <picture>
34
+ <source srcset="docs/assets/layout-demo.avif" type="image/avif">
35
+ <source srcset="docs/assets/layout-demo.webp" type="image/webp">
36
+ <img src="docs/assets/layout-demo.png" alt="jekyll-theme-flow layout shells">
37
+ </picture>
38
+ <!-- markdownlint-enable MD033 -->
39
+
22
40
  ## Installation
23
41
 
24
42
  ```ruby
@@ -33,8 +51,9 @@ theme: jekyll-theme-flow
33
51
 
34
52
  `theme:` alone gives you layouts, includes, Sass and assets — Jekyll
35
53
  also auto-requires the theme's runtime dependencies
36
- (`jekyll-client-search`, `jekyll-icon-flow`, `jekyll-sitemap`), so the
37
- tags, search assets and `sitemap.xml` work without listing them.
54
+ (`jekyll-client-search`, `jekyll-icon-flow`, `jekyll-seo-tag`,
55
+ `jekyll-sitemap`), so the tags, search assets, SEO meta and
56
+ `sitemap.xml` work without listing them.
38
57
 
39
58
  Every `flow.*`/`icon_flow.*`/`client_search.*` option has a sensible
40
59
  default — the theme renders with zero config beyond `theme:`, and each
@@ -75,12 +94,23 @@ Named layouts (`sidebar-left`, `sidebar-right`, `topnav`, `bare`) also
75
94
  work directly in front matter.
76
95
 
77
96
  | Shell | What you get |
78
- |---|---|
97
+ | --- | --- |
79
98
  | `sidebar-left` | Sticky left sidebar with expandable nav tree + content column (default) |
80
99
  | `sidebar-right` | Same, sidebar on the right |
81
100
  | `topnav` | Bulma navbar with hover dropdowns for children, no sidebar |
82
101
  | `bare` | Content only — no nav chrome |
83
102
 
103
+ The same demo front page rendered by each shell (real headless-Chrome
104
+ captures — `bundle exec rake docs:layouts` regenerates them):
105
+
106
+ <!-- markdownlint-disable MD033 -->
107
+ | `sidebar-left` | `sidebar-right` |
108
+ | --- | --- |
109
+ | <img src="docs/assets/layout-sidebar-left.png" alt="sidebar-left shell" width="560"> | <img src="docs/assets/layout-sidebar-right.png" alt="sidebar-right shell" width="560"> |
110
+ | `topnav` | `bare` |
111
+ | <img src="docs/assets/layout-topnav.png" alt="topnav shell" width="560"> | <img src="docs/assets/layout-bare.png" alt="bare shell" width="560"> |
112
+ <!-- markdownlint-enable MD033 -->
113
+
84
114
  On mobile, sidebars collapse into a burger-toggled drawer (Alpine).
85
115
 
86
116
  ## Navigation model
@@ -283,17 +313,73 @@ flow:
283
313
  favicon_enabled: true # set false to disable
284
314
  search_placeholder: "Search" # placeholder text in the search field
285
315
 
316
+ theme: auto # auto | light | dark — forces Bulma
317
+ # data-theme; auto follows the OS
318
+ breadcrumbs: true # "Parent > Child" above content
319
+ children_toc: true # auto child list at page bottom
320
+ back_to_top: false # floating back-to-top button
321
+ last_edit: true # "Page last modified" in footer when
322
+ # page.last_modified(_at/_date) is set
323
+ last_edit_format: "%-d %B %Y" # strftime for the timestamp
324
+ table_wrap: true # wrap tables in .table-container
325
+
286
326
  footer_text: "Powered by ..." # optional footer line
327
+ nav_cache: true # precompute nav tree once per build
328
+ # (plugin-loaded only); false = live
329
+ # Liquid scans
287
330
  # archive: # banner/footer strings, see "Archiving pages"
288
331
  ```
289
332
 
333
+ ## Just-the-docs conventions
334
+
335
+ The theme understands the front matter and config a
336
+ [just-the-docs](https://just-the-docs.com) site already carries, so
337
+ migrating mostly means swapping `theme:` and the Gemfile line:
338
+
339
+ | JTD convention | Behaviour here |
340
+ | --- | --- |
341
+ | `layout: home` / `page` / `post` | Aliases of `default` — pages keep working unchanged |
342
+ | `parent:`, `nav_order:`, `nav_exclude:`, `grand_parent:` | Same nav semantics; `nav_order` pages sort first, then unordered pages by title |
343
+ | `child_nav_order: reversed` (or `desc`) | Reverses the parent's child listing |
344
+ | `has_children: false`, `has_toc: false` | Disables the auto "Table of contents" child list |
345
+ | `nav_enabled: false` | Renders the `bare` shell for that page |
346
+ | `nav_external_links` | Appended to the sidebar nav (`title`, `url`, `opens_in_new_tab`, `hide_icon`) |
347
+ | `aux_links` + `aux_links_new_tab` | Header/topbar links (`{name: url}` hash) |
348
+ | `breadcrumbs: false` | Per-page opt-out of breadcrumbs (`flow.breadcrumbs: false` site-wide) |
349
+ | `favicon_ico:` | Used as the favicon when `flow.favicon` is unset (`flow.favicon_enabled` still applies) |
350
+ | `footer_content:` | Rendered as escaped plain text; use `footer_custom.html` for trusted markup |
351
+ | `last_edit_timestamp:` / `last_edit_time_format:` | Aliases for `flow.last_edit` / `flow.last_edit_format`; `last_modified_date` front matter also feeds the timestamp |
352
+ | `search_placeholder_custom` include | Overrides the search field placeholder (`flow.search_placeholder` is the config alternative) |
353
+ | `{: .note}` `.new` `.important` `.warning` `.highlight` | Callout classes mapped onto Bulma colours |
354
+ | `{% raw %}{% seo %}{% endraw %}` | Emitted by `head.html` — `jekyll-seo-tag` is a runtime dependency, so meta tags work with zero config |
355
+
356
+ Site includes named `head_custom`, `header_custom`, `footer_custom`,
357
+ `nav_footer_custom`, `toc_heading_custom` or
358
+ `search_placeholder_custom` are honoured at the equivalent spots
359
+ (theme ships them empty — your file wins, same as JTD).
360
+ `header_custom` renders inside the top bar next to the search slot;
361
+ `nav_footer_custom` renders at the bottom of the sidebar. The
362
+ `footer_content` config value is escaped as text; put trusted HTML in
363
+ `footer_custom.html` instead.
364
+
365
+ ## Nav performance
366
+
367
+ When the theme is plugin-loaded, a built-in generator groups and sorts
368
+ the nav pages once per build (`site.data["flow_nav"]`). This removes the
369
+ old full `site.html_pages` scan for every nav node on every rendered
370
+ page. Liquid still traverses the menu tree to emit each page's navigation,
371
+ so the final rendering cost remains proportional to the nav output.
372
+ Consumers using `theme:` without the plugin keep working: the includes
373
+ fall back to live scans. Disable the generator with
374
+ `flow.nav_cache: false`.
375
+
290
376
  ## Customization surface
291
377
 
292
378
  Intentionally small — the theme relies on Bulma components and helpers
293
379
  (`menu`, `navbar`, `columns`, `is-hidden-*`, spacing helpers) rather
294
- than bespoke CSS. The only custom CSS is the app shell (~50 lines in
295
- `_sass/flow.scss`): fixed/sticky sidebar, drawer positioning, chevron
296
- rotation, brand icon sizing.
380
+ than bespoke CSS. The only custom CSS is the app shell plus small
381
+ component styles (`_sass/flow.scss`): fixed/sticky sidebar, drawer
382
+ positioning, chevron rotation, brand icon sizing, callouts.
297
383
 
298
384
  Override the usual Jekyll way: same-named files in your site win
299
385
  (`_includes/`, `_layouts/`, `_sass/`). Bulma Sass variables can be
@@ -311,8 +397,12 @@ The theme's Ruby code in `lib/` is exercised through real consumer-site Jekyll
311
397
  builds; SimpleCov measures that coverage and CI uploads it to Codecov. The
312
398
  badge reflects `lib/` coverage — templates and vendored assets are not
313
399
  instrumented. SonarCloud analyses the repository automatically;
314
- the scanner excludes vendored Bulma and Alpine.
315
- Use `bundle exec rake "version:bump[patch]"` to bump the gemspec and lockfile,
400
+ the scanner excludes vendored Bulma and Alpine. Consumer-site tests assert
401
+ rendered HTML and accessibility attributes, while the Jekyll build compiles
402
+ Sass. The search dropdown JavaScript is owned by `jekyll-client-search` and
403
+ linted/tested in that gem; this theme does not currently run a dedicated HTML
404
+ validator or CSS linter.
405
+ Use `bundle exec rake "version:bump[patch]"` to bump `version.rb` and the lockfile,
316
406
  add a dated changelog entry, and run `bundle exec rake version:pre_release`
317
407
  before tagging. GitHub `release` environment and RubyGems trusted publishing
318
408
  must be configured before publishing.
@@ -0,0 +1,8 @@
1
+ {%- comment -%}
2
+ Aux links — just-the-docs parity for the `aux_links` config hash
3
+ ({name: url}). include.item_class styles each link for its slot
4
+ (navbar-item in topnav, ghost button in the sidebar top bar).
5
+ {%- endcomment -%}
6
+ {%- for link in site.aux_links -%}
7
+ <a class="{{ include.item_class | default: "button is-ghost is-small" }}" href="{{ link[1] | escape }}"{% if site.aux_links_new_tab %} target="_blank" rel="noopener"{% endif %}>{{ link[0] | escape }}</a>
8
+ {%- endfor -%}
@@ -0,0 +1,12 @@
1
+ {%- comment -%}
2
+ Floating back-to-top button. Opt-in: flow.back_to_top: true.
3
+ {%- endcomment -%}
4
+ {%- if site.flow.back_to_top -%}
5
+ <button type="button" class="button is-small back-to-top" x-data="{ show: false }"
6
+ x-init="window.addEventListener('scroll', () => { show = window.scrollY > 400 }, { passive: true })"
7
+ x-show="show" x-cloak x-transition.opacity
8
+ @click="window.scrollTo({ top: 0, behavior: 'smooth' })"
9
+ aria-label="Back to top">
10
+ <span class="icon">{% icon_lucide arrow-up %}</span>
11
+ </button>
12
+ {%- endif %}
@@ -0,0 +1,31 @@
1
+ {%- comment -%}
2
+ Ancestor breadcrumbs — walks `parent:` front matter upward and renders
3
+ a Bulma breadcrumb (just-the-docs parity: Region > Town).
4
+ Disable per site: flow.breadcrumbs: false
5
+ Disable per page: breadcrumbs: false
6
+ {%- endcomment -%}
7
+ {%- if site.flow.breadcrumbs != false and page.breadcrumbs != false and page.parent -%}
8
+ {%- assign crumbs = "" | split: "" -%}
9
+ {%- assign crumb_title = page.parent -%}
10
+ {%- for i in (1..8) -%}
11
+ {%- assign ancestor = site.data.flow_nav.index[crumb_title] -%}
12
+ {%- if ancestor == nil -%}
13
+ {%- assign ancestor = site.html_pages | where: "title", crumb_title | first -%}
14
+ {%- endif -%}
15
+ {%- if ancestor -%}
16
+ {%- assign crumbs = crumbs | unshift: ancestor -%}
17
+ {%- assign crumb_title = ancestor.parent -%}
18
+ {%- else -%}
19
+ {%- assign crumb_title = nil -%}
20
+ {%- endif -%}
21
+ {%- unless crumb_title %}{% break %}{% endunless %}
22
+ {%- endfor -%}
23
+ <nav class="breadcrumb has-succeeds-separator" aria-label="breadcrumbs">
24
+ <ul>
25
+ {%- for c in crumbs -%}
26
+ <li><a href="{{ c.url | relative_url }}">{{ c.title | escape }}</a></li>
27
+ {%- endfor -%}
28
+ <li class="is-active"><a href="{{ page.url | relative_url }}" aria-current="page">{{ page.title | escape }}</a></li>
29
+ </ul>
30
+ </nav>
31
+ {%- endif %}
@@ -0,0 +1,28 @@
1
+ {%- comment -%}
2
+ Auto "Table of contents" child list at the bottom of parent pages
3
+ (just-the-docs children_nav parity). Renders only when the page has
4
+ children. Disable per site: flow.children_toc: false — per page:
5
+ has_toc: false. Honour has_children: false and child_nav_order.
6
+ {%- endcomment -%}
7
+ {%- if site.flow.children_toc != false and page.has_children != false and page.has_toc != false -%}
8
+ {%- assign toc_kids = site.data.flow_nav.index[page.title].children -%}
9
+ {%- if toc_kids == nil -%}
10
+ {%- assign toc_all = site.html_pages | where: "parent", page.title | where_exp: "k", "k.nav_exclude != true" -%}
11
+ {%- assign toc_ordered = toc_all | where_exp: "k", "k.nav_order" | sort: "nav_order" -%}
12
+ {%- assign toc_unordered = toc_all | where_exp: "k", "k.nav_order == nil" | sort_natural: "title" -%}
13
+ {%- assign toc_kids = toc_ordered | concat: toc_unordered -%}
14
+ {%- if page.child_nav_order == "reversed" or page.child_nav_order == "desc" or page.child_nav_order == "descending" %}
15
+ {%- assign toc_kids = toc_kids | reverse -%}
16
+ {%- endif %}
17
+ {%- endif %}
18
+ {%- if toc_kids.size > 0 -%}
19
+ <nav class="flow-children-toc" aria-label="child pages">
20
+ {% include toc_heading_custom.html %}
21
+ <ul>
22
+ {%- for k in toc_kids -%}
23
+ <li><a href="{{ k.url | relative_url }}">{{ k.title | escape }}</a></li>
24
+ {%- endfor -%}
25
+ </ul>
26
+ </nav>
27
+ {%- endif -%}
28
+ {%- endif %}
@@ -1,5 +1,17 @@
1
+ {%- comment -%}
2
+ Timestamp sources: jekyll-last-modified-at (last_modified_at),
3
+ front matter last_modified, or JTD's last_modified_date. Enabled
4
+ unless flow.last_edit: false or JTD's last_edit_timestamp: false.
5
+ {%- endcomment -%}
6
+ {%- assign last_mod = page.last_modified_at | default: page.last_modified | default: page.last_modified_date -%}
7
+ {%- assign le_format = site.flow.last_edit_format | default: site.last_edit_time_format | default: "%-d %B %Y" -%}
1
8
  <footer class="footer py-4">
2
9
  <div class="content has-text-centered is-size-7">
10
+ {%- if last_mod and site.flow.last_edit != false and site.last_edit_timestamp != false -%}
11
+ <p>Page last modified: {{ last_mod | date: le_format }}</p>
12
+ {%- endif -%}
3
13
  <p>{{ site.title | escape }}{% if site.flow.footer_text %} · {{ site.flow.footer_text | escape }}{% endif %}</p>
14
+ {%- if site.footer_content -%}<p>{{ site.footer_content | escape }}</p>{%- endif -%}
15
+ {% include footer_custom.html %}
4
16
  </div>
5
17
  </footer>
@@ -0,0 +1,4 @@
1
+ {%- comment -%}
2
+ Override hook — intentionally empty. Create _includes/footer_custom.html in
3
+ your site to inject markup here (same convention as just-the-docs).
4
+ {%- endcomment -%}
data/_includes/head.html CHANGED
@@ -1,9 +1,10 @@
1
- <head>
1
+ {%- assign favicon_path = site.flow.favicon | default: site.favicon_ico -%}
2
+ <head>{% comment %}<!-- //NOSONAR --> Web:PageWithoutTitleCheck: <title> is emitted by {% seo %} (jekyll-seo-tag), which the SonarCloud Web analyzer cannot expand{% endcomment %}
2
3
  <meta charset="utf-8">
3
4
  <meta name="viewport" content="width=device-width, initial-scale=1">
4
- <title>{% if page.title %}{{ page.title | escape }} · {% endif %}{{ site.title | escape }}</title>
5
- <meta name="description" content="{{ page.description | default: site.description | strip_html | strip | escape }}">
5
+ {% seo %}
6
6
  {% if page.noindex or page.layout == "archive" %}<meta name="robots" content="noindex">{% endif %}
7
7
  <link rel="stylesheet" href="{{ '/assets/css/theme.css' | relative_url }}">
8
- {% if site.flow.favicon and site.flow.favicon_enabled != false %}<link rel="icon" href="{{ site.flow.favicon | relative_url | escape }}">{% endif %}
8
+ {% if favicon_path and site.flow.favicon_enabled != false %}<link rel="icon" href="{{ favicon_path | relative_url | escape }}">{% endif %}
9
+ {% include head_custom.html %}
9
10
  </head>
@@ -0,0 +1,4 @@
1
+ {%- comment -%}
2
+ Override hook — intentionally empty. Create _includes/head_custom.html in
3
+ your site to inject markup here (same convention as just-the-docs).
4
+ {%- endcomment -%}
@@ -0,0 +1,4 @@
1
+ {%- comment -%}
2
+ Override hook — intentionally empty. Create _includes/header_custom.html in
3
+ your site to inject markup here (same convention as just-the-docs).
4
+ {%- endcomment -%}
@@ -0,0 +1,4 @@
1
+ {%- comment -%}
2
+ Override hook — intentionally empty. Create _includes/nav_footer_custom.html in
3
+ your site to inject markup here (same convention as just-the-docs).
4
+ {%- endcomment -%}
@@ -2,11 +2,27 @@
2
2
  Recursive nav tree. include.pages = array of pages at this level.
3
3
  Children are matched via `parent: <parent title>` front matter.
4
4
  Auto-opens when the current page is this node, a child (`parent`),
5
- or a grandchild (`grand_parent`).
5
+ or a grandchild (`grand_parent`). Sorting is just-the-docs parity:
6
+ `nav_order` pages first, then unordered pages by title; a parent can
7
+ flip its children with `child_nav_order: reversed`, `desc`, or
8
+ `descending`.
6
9
  {%- endcomment -%}
7
10
  <ul class="menu-list">
8
11
  {%- for p in include.pages -%}
9
- {%- assign kids = site.html_pages | where: "parent", p.title | where_exp: "k", "k.nav_exclude != true" | sort: "nav_order" -%}
12
+ {%- comment -%}
13
+ Fast path: when the theme is plugin-loaded, NavGenerator fills
14
+ site.data.flow_nav and nodes arrive as hashes with `children`.
15
+ `p.children` is nil on a Jekyll::Page drop, so `theme:`-only
16
+ consumers fall back to live scans here.
17
+ {%- endcomment -%}
18
+ {%- assign kids = p.children -%}
19
+ {%- if kids == nil -%}
20
+ {%- assign kids_all = site.html_pages | where: "parent", p.title | where_exp: "k", "k.nav_exclude != true" -%}
21
+ {%- assign kids_ordered = kids_all | where_exp: "k", "k.nav_order" | sort: "nav_order" -%}
22
+ {%- assign kids_unordered = kids_all | where_exp: "k", "k.nav_order == nil" | sort_natural: "title" -%}
23
+ {%- assign kids = kids_ordered | concat: kids_unordered -%}
24
+ {%- if p.child_nav_order == "reversed" or p.child_nav_order == "desc" or p.child_nav_order == "descending" %}{% assign kids = kids | reverse %}{% endif -%}
25
+ {%- endif -%}
10
26
  {%- assign is_active = false -%}
11
27
  {%- if p.url == page.url or page.parent == p.title -%}{%- assign is_active = true -%}{%- endif -%}
12
28
  {%- if kids.size > 0 -%}
@@ -18,8 +34,9 @@
18
34
  {%- if p.icon %}<span class="icon">{% icon p.icon %}</span> {% endif -%}
19
35
  {{- p.title | escape -}}
20
36
  </a>
21
- <button class="button is-ghost is-small px-2" @click="open = !open" :aria-expanded="open" aria-label="Toggle {{ p.title | escape }}">
22
- <span class="icon flow-chevron" :class="{ 'is-open': open }">
37
+ <button class="button is-ghost is-small px-2" @click="open = !open" :aria-expanded="open">
38
+ <span class="is-sr-only">Toggle {{ p.title | escape }}</span>
39
+ <span class="icon flow-chevron" :class="{ 'is-open': open }" aria-hidden="true">
23
40
  {% icon_lucide chevron-right %}
24
41
  </span>
25
42
  </button>
@@ -1,23 +1,40 @@
1
- {%- assign nav_roots = site.html_pages | where_exp: "p", "p.title" | where_exp: "p", "p.nav_exclude != true" | where_exp: "p", "p.parent == nil" | sort: "nav_order" -%}
1
+ {%- assign menu_label_id = include.mode | default: "topnav" | append: "-menu-label" | slugify -%}
2
+ {%- assign nav_roots = site.data.flow_nav.roots -%}
3
+ {%- unless nav_roots -%}
4
+ {%- assign nav_all = site.html_pages | where_exp: "p", "p.title" | where_exp: "p", "p.nav_exclude != true" | where_exp: "p", "p.parent == nil" -%}
5
+ {%- assign nav_ordered = nav_all | where_exp: "p", "p.nav_order" | sort: "nav_order" -%}
6
+ {%- assign nav_unordered = nav_all | where_exp: "p", "p.nav_order == nil" | sort_natural: "title" -%}
7
+ {%- assign nav_roots = nav_ordered | concat: nav_unordered -%}
8
+ {%- endunless -%}
2
9
  <nav class="navbar{% if include.mode == "mobile-only" %} is-hidden-desktop{% endif %}" role="navigation" aria-label="main navigation" x-data="{ open: false }">
3
10
  <div class="navbar-brand">
4
11
  <a class="navbar-item has-text-weight-semibold" href="{{ '/' | relative_url }}">
5
12
  {%- if site.flow.logo and site.flow.logo_enabled != false %}<img class="flow-brand-icon" src="{{ site.flow.logo | relative_url | escape }}" alt="">{% endif %}
6
13
  {{- site.title | escape -}}
7
14
  </a>
8
- {% if include.mode == "mobile-only" -%}
9
- <button class="navbar-burger" :class="{ 'is-active': menu }" @click="menu = !menu" :aria-expanded="menu" aria-label="menu">
10
- {%- else -%}
11
- <button class="navbar-burger" :class="{ 'is-active': open }" @click="open = !open" :aria-expanded="open" aria-label="menu">
12
- {%- endif %}
13
- <span aria-hidden="true"></span><span aria-hidden="true"></span><span aria-hidden="true"></span><span aria-hidden="true"></span>
14
- </button>
15
+ <div class="flow-navbar-menu-toggle is-hidden-desktop">
16
+ <span id="{{ menu_label_id }}" class="flow-navbar-menu-label">Menu</span>
17
+ {% if include.mode == "mobile-only" -%}
18
+ <button class="navbar-burger" :class="{ 'is-active': menu }" @click="menu = !menu" :aria-expanded="menu" aria-labelledby="{{ menu_label_id }}">
19
+ {%- else -%}
20
+ <button class="navbar-burger" :class="{ 'is-active': open }" @click="open = !open" :aria-expanded="open" aria-labelledby="{{ menu_label_id }}">
21
+ {%- endif %}
22
+ <span aria-hidden="true"></span><span aria-hidden="true"></span><span aria-hidden="true"></span><span aria-hidden="true"></span>
23
+ </button>
24
+ </div>
15
25
  </div>
16
26
  {% unless include.mode == "mobile-only" -%}
17
27
  <div class="navbar-menu" :class="{ 'is-active': open }">
18
28
  <div class="navbar-start">
19
29
  {% for p in nav_roots -%}
20
- {%- assign kids = site.html_pages | where: "parent", p.title | where_exp: "k", "k.nav_exclude != true" | sort: "nav_order" -%}
30
+ {%- assign kids = p.children -%}
31
+ {%- if kids == nil -%}
32
+ {%- assign kids_all = site.html_pages | where: "parent", p.title | where_exp: "k", "k.nav_exclude != true" -%}
33
+ {%- assign kids_ordered = kids_all | where_exp: "k", "k.nav_order" | sort: "nav_order" -%}
34
+ {%- assign kids_unordered = kids_all | where_exp: "k", "k.nav_order == nil" | sort_natural: "title" -%}
35
+ {%- assign kids = kids_ordered | concat: kids_unordered -%}
36
+ {%- if p.child_nav_order == "reversed" or p.child_nav_order == "desc" or p.child_nav_order == "descending" %}{% assign kids = kids | reverse %}{% endif -%}
37
+ {%- endif -%}
21
38
  {%- assign p_active = false -%}
22
39
  {%- if p.url == page.url or page.parent == p.title %}{% assign p_active = true %}{% endif -%}
23
40
  {%- if kids.size > 0 %}
@@ -43,13 +60,18 @@
43
60
  {%- endif -%}
44
61
  {% endfor %}
45
62
  </div>
46
- {% if site.client_search.enabled -%}
63
+ {%- if site.client_search.enabled or site.aux_links -%}
47
64
  <div class="navbar-end">
65
+ {%- if site.aux_links -%}
66
+ {% include aux_links.html item_class="navbar-item" %}
67
+ {%- endif -%}
68
+ {%- if site.client_search.enabled -%}
48
69
  <div class="navbar-item">
49
70
  {% include search_slot.html input_size=" is-small" %}
50
71
  </div>
72
+ {%- endif -%}
51
73
  </div>
52
- {%- endif %}
74
+ {%- endif -%}
53
75
  </div>
54
76
  {%- endunless %}
55
77
  </nav>
@@ -0,0 +1,6 @@
1
+ {%- comment -%}
2
+ Override hook — intentionally empty. Create
3
+ _includes/search_placeholder_custom.html in your site to set the
4
+ search field placeholder (same convention as just-the-docs);
5
+ flow.search_placeholder is the config alternative.
6
+ {%- endcomment -%}
@@ -1,19 +1,30 @@
1
1
  {%- comment -%}
2
2
  Search slot for jekyll-client-search. Renders nothing unless
3
3
  site.client_search.enabled. include.input_size: "" or " is-small".
4
+ The no-JS form submit follows client_search.dropdown.redirect_url.
5
+ Placeholder precedence: search_placeholder_custom include >
6
+ flow.search_placeholder > "Search" (JTD convention).
4
7
  {%- endcomment -%}
5
8
  {%- if site.client_search.enabled -%}
6
9
  {%- assign slot_id = include.input_size | default: "full" | slugify -%}
10
+ {%- assign search_redirect = site.client_search.dropdown.redirect_url | default: "/search/" -%}
11
+ {%- if search_redirect == "" %}{% assign search_redirect = "/search/" %}{% endif -%}
12
+ {%- capture search_placeholder -%}{% include search_placeholder_custom.html %}{%- endcapture -%}
13
+ {%- assign search_placeholder = search_placeholder | strip | default: site.flow.search_placeholder | default: "Search" -%}
7
14
  <div class="flow-search" data-client-search-dropdown>
8
- <form class="control has-icons-left" role="search" action="{{ '/search/' | relative_url }}" method="get" autocomplete="off" data-cs-dropdown-form>
9
- <label class="is-sr-only" for="flow-search-input-{{ slot_id }}">{{ site.flow.search_placeholder | default: "Search" | escape }}</label>
10
- <input id="flow-search-input-{{ slot_id }}" class="input{{ include.input_size }}" type="search" name="q" autocomplete="off"
11
- placeholder="{{ site.flow.search_placeholder | default: "Search" | escape }}"
15
+ <form class="control has-icons-left" role="search" action="{{ search_redirect | relative_url }}" method="get" autocomplete="off" data-cs-dropdown-form>
16
+ <label class="is-sr-only" id="flow-search-label-{{ slot_id }}" for="flow-search-input-{{ slot_id }}">{{ search_placeholder | escape }}</label>
17
+ <input id="flow-search-input-{{ slot_id }}" class="input{{ include.input_size }}" type="search" name="q" role="combobox"
18
+ aria-autocomplete="list" aria-haspopup="listbox" autocomplete="off"
19
+ placeholder="{{ search_placeholder | escape }}"
12
20
  aria-expanded="false" aria-controls="flow-search-results-{{ slot_id }}"
13
21
  data-cs-dropdown-input>
14
22
  <span class="icon is-left" aria-hidden="true">{% icon_lucide search size:"0.875em" %}</span>
15
23
  </form>
16
- <ul id="flow-search-results-{{ slot_id }}" class="flow-search-results"
17
- role="listbox" aria-hidden="true" data-cs-dropdown-results></ul>
24
+ <div id="flow-search-results-{{ slot_id }}" class="flow-search-results"
25
+ role="listbox" aria-label="Search suggestions">
26
+ <ul class="flow-search-results-items" role="presentation"
27
+ aria-hidden="true" data-cs-dropdown-results></ul>
28
+ </div>
18
29
  </div>
19
30
  {%- endif %}
@@ -1,5 +1,7 @@
1
- <main class="section">
1
+ <main class="section" id="main-content">
2
2
  <div class="content">
3
+ {% include breadcrumbs.html %}
3
4
  {{ content }}
4
5
  </div>
6
+ {% include children_toc.html %}
5
7
  </main>
@@ -4,15 +4,22 @@
4
4
  </aside>
5
5
  <div class="column">
6
6
  {% include navbar.html mode="mobile-only" %}
7
- {% if site.client_search.enabled %}
7
+ {%- capture flow_header_custom -%}{% include header_custom.html %}{%- endcapture -%}
8
+ {%- if site.client_search.enabled or site.aux_links or flow_header_custom != "" -%}
8
9
  <div class="flow-topbar">
9
10
  {% include search_slot.html %}
11
+ {{ flow_header_custom }}
12
+ {%- if site.aux_links -%}
13
+ <div class="flow-aux-links">{% include aux_links.html %}</div>
14
+ {%- endif -%}
10
15
  </div>
11
- {% endif %}
12
- <main class="section">
16
+ {%- endif -%}
17
+ <main class="section" id="main-content">
13
18
  <div class="content">
19
+ {% include breadcrumbs.html %}
14
20
  {{ content }}
15
21
  </div>
22
+ {% include children_toc.html %}
16
23
  </main>
17
24
  </div>
18
25
  </div>
@@ -1,15 +1,22 @@
1
1
  <div class="columns is-gapless m-0 flow-shell" x-data="{ menu: false }">
2
2
  <div class="column">
3
3
  {% include navbar.html mode="mobile-only" %}
4
- {% if site.client_search.enabled %}
4
+ {%- capture flow_header_custom -%}{% include header_custom.html %}{%- endcapture -%}
5
+ {%- if site.client_search.enabled or site.aux_links or flow_header_custom != "" -%}
5
6
  <div class="flow-topbar">
6
7
  {% include search_slot.html %}
8
+ {{ flow_header_custom }}
9
+ {%- if site.aux_links -%}
10
+ <div class="flow-aux-links">{% include aux_links.html %}</div>
11
+ {%- endif -%}
7
12
  </div>
8
- {% endif %}
9
- <main class="section">
13
+ {%- endif -%}
14
+ <main class="section" id="main-content">
10
15
  <div class="content">
16
+ {% include breadcrumbs.html %}
11
17
  {{ content }}
12
18
  </div>
19
+ {% include children_toc.html %}
13
20
  </main>
14
21
  </div>
15
22
  <aside class="column is-narrow flow-sidebar flow-right has-background-light" :class="{ 'is-hidden-mobile': !menu }" @click.outside="menu = false">
@@ -1,8 +1,10 @@
1
1
  {% include navbar.html %}
2
- <main class="section">
2
+ <main class="section" id="main-content">
3
3
  <div class="container">
4
4
  <div class="content">
5
+ {% include breadcrumbs.html %}
5
6
  {{ content }}
6
7
  </div>
8
+ {% include children_toc.html %}
7
9
  </div>
8
10
  </main>
@@ -5,6 +5,26 @@
5
5
  </a>
6
6
  </div>
7
7
  <nav class="menu px-4 pb-4" aria-label="site navigation">
8
- {%- assign nav_roots = site.html_pages | where_exp: "p", "p.title" | where_exp: "p", "p.nav_exclude != true" | where_exp: "p", "p.parent == nil" | sort: "nav_order" -%}
8
+ {%- assign nav_roots = site.data.flow_nav.roots -%}
9
+ {%- unless nav_roots -%}
10
+ {%- assign nav_all = site.html_pages | where_exp: "p", "p.title" | where_exp: "p", "p.nav_exclude != true" | where_exp: "p", "p.parent == nil" -%}
11
+ {%- assign nav_ordered = nav_all | where_exp: "p", "p.nav_order" | sort: "nav_order" -%}
12
+ {%- assign nav_unordered = nav_all | where_exp: "p", "p.nav_order == nil" | sort_natural: "title" -%}
13
+ {%- assign nav_roots = nav_ordered | concat: nav_unordered -%}
14
+ {%- endunless -%}
9
15
  {% include nav_tree.html pages=nav_roots %}
16
+ {%- if site.nav_external_links -%}
17
+ <ul class="menu-list">
18
+ {%- for link in site.nav_external_links -%}
19
+ <li><a href="{{ link.url | relative_url | escape }}"{% if link.opens_in_new_tab %} target="_blank" rel="noopener"{% endif %}>
20
+ {{- link.title | escape -}}
21
+ {%- unless link.hide_icon %} <span class="icon">{% icon_lucide external-link %}</span>{% endunless -%}
22
+ </a></li>
23
+ {%- endfor -%}
24
+ </ul>
25
+ {%- endif -%}
10
26
  </nav>
27
+ {%- capture flow_nav_footer -%}{% include nav_footer_custom.html %}{%- endcapture -%}
28
+ {%- if flow_nav_footer != "" -%}
29
+ <div class="flow-sidebar-footer px-4 pb-4 is-size-7">{{ flow_nav_footer }}</div>
30
+ {%- endif %}
@@ -0,0 +1 @@
1
+ <h2 class="title is-6">Table of contents</h2>
@@ -1,14 +1,30 @@
1
1
  ---
2
2
  ---
3
3
  {%- assign flow_variant = page.flow_layout | default: layout.flow_layout | default: site.flow.layout | default: "sidebar-left" -%}
4
+ {%- if page.nav_enabled == false or page.nav_enabled == nil and site.nav_enabled == false -%}
5
+ {%- assign flow_variant = "bare" -%}
6
+ {%- endif -%}
4
7
  <!doctype html>
5
- <html lang="{{ page.lang | default: site.lang | default: "en" | escape }}">{% comment %}<!-- //NOSONAR --> Web:PageWithoutTitleCheck: <title> is rendered by _includes/head.html, which the SonarCloud Web analyzer cannot follow{% endcomment %}
8
+ <html lang="{{ page.lang | default: site.lang | default: "en" | escape }}"{% if site.flow.theme == "light" or site.flow.theme == "dark" %} data-theme="{{ site.flow.theme | escape }}"{% endif %}>{% comment %}<!-- //NOSONAR --> Web:PageWithoutTitleCheck: <title> is rendered by {% seo %} inside _includes/head.html, which the SonarCloud Web analyzer cannot follow{% endcomment %}
6
9
  {% include head.html %}
7
10
  <body>
11
+ <a class="skip-to-main" href="#main-content">Skip to main content</a>
8
12
  {% assign shell = "shells/" | append: flow_variant | append: ".html" %}
9
13
  {% include {{ shell }} %}
10
14
  {% include footer.html %}
15
+ {% include back_to_top.html %}
11
16
  {% if site.client_search.enabled %}{% search_dropdown scripts_only %}{% endif %}
17
+ {%- if site.flow.table_wrap != false -%}
18
+ <script>
19
+ document.querySelectorAll("#main-content table").forEach(function (table) {
20
+ if (table.parentElement.classList.contains("table-container")) return;
21
+ var wrapper = document.createElement("div");
22
+ wrapper.className = "table-container";
23
+ table.parentNode.insertBefore(wrapper, table);
24
+ wrapper.appendChild(table);
25
+ });
26
+ </script>
27
+ {%- endif %}
12
28
  <script src="{{ '/assets/js/alpine.min.js' | relative_url }}" defer></script>
13
29
  </body>
14
30
  </html>
@@ -0,0 +1,5 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ {{ content }}
@@ -0,0 +1,5 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ {{ content }}
@@ -0,0 +1,5 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ {{ content }}
data/_sass/flow.scss CHANGED
@@ -64,6 +64,21 @@
64
64
  vertical-align: -0.125em;
65
65
  }
66
66
 
67
+ .flow-navbar-menu-toggle {
68
+ display: flex;
69
+ align-items: center;
70
+ gap: 0.25rem;
71
+ margin-inline-start: auto;
72
+ }
73
+
74
+ .flow-navbar-menu-label {
75
+ font-size: 0.75rem;
76
+ }
77
+
78
+ .flow-navbar-menu-toggle .navbar-burger {
79
+ margin-inline-start: 0;
80
+ }
81
+
67
82
  // jekyll-icon-flow icons — svg elements carrying the normalized
68
83
  // .icon contract; nudge to text baseline (Bulma's own .icon class
69
84
  // targets wrapper elements, not the svg itself)
@@ -86,7 +101,7 @@ svg.icon {
86
101
  }
87
102
  }
88
103
 
89
- .flow-search-results {
104
+ .flow-search-results-items {
90
105
  position: absolute;
91
106
  top: 100%;
92
107
  right: 0;
@@ -114,18 +129,109 @@ svg.icon {
114
129
  }
115
130
 
116
131
  .client-search-dropdown-item {
117
- padding: 0;
132
+ display: flex;
133
+ align-items: center;
134
+ gap: 0.3rem;
135
+ padding: 0.5rem 0.75rem;
118
136
  margin: 0;
137
+ cursor: pointer;
119
138
  }
120
139
 
121
140
  .client-search-dropdown-link {
122
141
  display: block;
123
- padding: 0.5rem 0.75rem;
124
142
  color: var(--bulma-text);
125
143
  text-decoration: none;
126
144
  }
127
145
 
128
- .client-search-dropdown-link:hover,
129
- .client-search-dropdown-item[aria-selected="true"] .client-search-dropdown-link {
146
+ .client-search-dropdown-item:hover,
147
+ .client-search-dropdown-item[aria-selected="true"] {
130
148
  background: var(--bulma-scheme-main-bis);
131
149
  }
150
+
151
+ // Skip-to-main link — visually hidden until focused (a11y).
152
+ .skip-to-main {
153
+ position: absolute;
154
+ top: -4rem;
155
+ left: 0.5rem;
156
+ z-index: 100;
157
+ padding: 0.5rem 0.75rem;
158
+ color: var(--bulma-text-strong);
159
+ background: var(--bulma-scheme-main);
160
+ border: 1px solid var(--bulma-border);
161
+ border-radius: var(--bulma-radius);
162
+ transition: top 150ms ease;
163
+ }
164
+
165
+ .skip-to-main:focus {
166
+ top: 0.5rem;
167
+ }
168
+
169
+ // Top bar — search slot grows, custom markup and aux links sit right.
170
+ .flow-topbar {
171
+ display: flex;
172
+ align-items: center;
173
+ gap: 0.75rem;
174
+
175
+ .flow-search {
176
+ flex: 1 1 auto;
177
+ }
178
+ }
179
+
180
+ .flow-aux-links {
181
+ display: flex;
182
+ flex-shrink: 0;
183
+ gap: 0.25rem;
184
+ align-items: center;
185
+ }
186
+
187
+ // "Table of contents" child list at the bottom of parent pages.
188
+ .flow-children-toc {
189
+ padding-top: 1rem;
190
+ margin-top: 2rem;
191
+ border-top: 1px solid var(--bulma-border);
192
+ }
193
+
194
+ // Sidebar footer slot (nav_footer_custom).
195
+ .flow-sidebar-footer {
196
+ border-top: 1px solid var(--bulma-border);
197
+ }
198
+
199
+ // Floating back-to-top button (flow.back_to_top).
200
+ .back-to-top {
201
+ position: fixed;
202
+ right: 1rem;
203
+ bottom: 1rem;
204
+ z-index: 40;
205
+ box-shadow: var(--bulma-shadow);
206
+ }
207
+
208
+ // Callout aliases — just-the-docs conventions mapped onto Bulma
209
+ // notification colors, so `{: .note}` etc. keep working on migrated
210
+ // content.
211
+ :is(.note, .new, .important, .warning, .highlight) {
212
+ padding: 1rem 1.25rem;
213
+ margin-bottom: 1rem;
214
+ border-left: 0.25rem solid;
215
+ border-radius: var(--bulma-radius);
216
+ }
217
+
218
+ .note {
219
+ background: var(--bulma-info-soft);
220
+ border-color: var(--bulma-info);
221
+ }
222
+
223
+ .new {
224
+ background: var(--bulma-success-soft);
225
+ border-color: var(--bulma-success);
226
+ }
227
+
228
+ .important {
229
+ background: var(--bulma-danger-soft);
230
+ border-color: var(--bulma-danger);
231
+ }
232
+
233
+ .warning,
234
+ .highlight {
235
+ background: var(--bulma-warning-soft);
236
+ border-color: var(--bulma-warning-bold);
237
+ }
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module ThemeFlow
5
+ # Builds the whole nav tree once per build into
6
+ # site.data["flow_nav"] = { "roots" => [...], "index" => {...} }.
7
+ #
8
+ # Before this generator, Liquid scanned `site.html_pages` for each
9
+ # nav node on each rendered page. This groups and sorts pages once;
10
+ # Liquid still traverses the tree on each page to emit its menu, but
11
+ # no longer rescans the whole page collection per node. Templates
12
+ # read precomputed children from hashes:
13
+ # `p.children` on a node hash is an array, while on a Jekyll::Page
14
+ # drop it is nil, which is what lets the same template fall back
15
+ # to live scans for `theme:`-only consumers (this file only loads
16
+ # via `plugins:` or the :jekyll_plugins Bundler group).
17
+ #
18
+ # Ordering matches the Liquid path exactly: `nav_order` pages
19
+ # first, unordered pages case-insensitive natural sort by title,
20
+ # and a parent may flip its own children with
21
+ # `child_nav_order: reversed|desc|descending`.
22
+ class NavGenerator < Jekyll::Generator
23
+ safe true
24
+
25
+ REVERSED = %w[reversed desc descending].freeze
26
+ MAX_DEPTH = 8
27
+ NUMBERED_PART = /(\d+)/
28
+
29
+ def generate(site)
30
+ # Escape hatch: flow.nav_cache: false keeps the Liquid fallback.
31
+ return if site.config.dig("flow", "nav_cache") == false
32
+
33
+ by_parent = nav_pages(site).group_by { |page| page.data["parent"] }
34
+ roots = build_level(by_parent[nil], nil, by_parent)
35
+ index = {}
36
+ index_level(roots, index)
37
+ site.data["flow_nav"] = { "roots" => roots, "index" => index }
38
+ end
39
+
40
+ # `site.html_pages` is Liquid-only — this is the Ruby equivalent.
41
+ def nav_pages(site)
42
+ site.pages.select do |page|
43
+ page.html? && page.data["title"] && page.data["nav_exclude"] != true
44
+ end
45
+ end
46
+
47
+ private
48
+
49
+ def build_level(kids, parent_page, by_parent, depth = 0)
50
+ return [] if depth > MAX_DEPTH
51
+
52
+ kids = sort_level(kids || [])
53
+ kids.reverse! if reversed?(parent_page)
54
+ kids.map { |child| node_for(child, by_parent, depth) }
55
+ end
56
+
57
+ def reversed?(page)
58
+ page && REVERSED.include?(page.data["child_nav_order"])
59
+ end
60
+
61
+ def node_for(child, by_parent, depth)
62
+ {
63
+ "title" => child.data["title"],
64
+ "url" => child.url,
65
+ "icon" => child.data["icon"],
66
+ "parent" => child.data["parent"],
67
+ "children" => build_level(by_parent[child.data["title"]], child, by_parent, depth + 1)
68
+ }
69
+ end
70
+
71
+ def sort_level(list)
72
+ ordered, unordered = list.partition { |page| page.data["nav_order"] }
73
+ ordered.sort_by! { |page| page.data["nav_order"] }
74
+ unordered.sort_by! { |page| natural_key(page.data["title"]) }
75
+ ordered + unordered
76
+ end
77
+
78
+ # Case-insensitive natural sort key matching Liquid's
79
+ # sort_natural: "Section 2" < "Section 10".
80
+ def natural_key(title)
81
+ title.to_s.downcase.split(NUMBERED_PART).map do |part|
82
+ part.match?(/\A\d+\z/) ? [0, part.to_i] : [1, part]
83
+ end
84
+ end
85
+
86
+ def index_level(nodes, index)
87
+ nodes.each do |node|
88
+ index[node["title"]] ||= node
89
+ index_level(node["children"], index)
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module ThemeFlow
5
+ VERSION = "0.3.1"
6
+ end
7
+ end
@@ -1,7 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "jekyll"
4
+ require "jekyll-seo-tag"
4
5
  require "jekyll-sitemap"
6
+ require "jekyll/theme_flow/nav_generator"
7
+ require "jekyll/theme_flow/version"
5
8
 
6
9
  # Plugin side of the theme. Layouts/includes work via
7
10
  # `theme: jekyll-theme-flow` alone; this file is only evaluated when the
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svend Gundestrup
@@ -63,6 +63,26 @@ dependencies:
63
63
  - - "~>"
64
64
  - !ruby/object:Gem::Version
65
65
  version: '0.1'
66
+ - !ruby/object:Gem::Dependency
67
+ name: jekyll-seo-tag
68
+ requirement: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '2.0'
73
+ - - "<"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '2.0'
83
+ - - "<"
84
+ - !ruby/object:Gem::Version
85
+ version: '3.0'
66
86
  - !ruby/object:Gem::Dependency
67
87
  name: jekyll-sitemap
68
88
  requirement: !ruby/object:Gem::Requirement
@@ -93,21 +113,34 @@ files:
93
113
  - LICENSE.txt
94
114
  - README.md
95
115
  - _includes/archive_versions.html
116
+ - _includes/aux_links.html
117
+ - _includes/back_to_top.html
118
+ - _includes/breadcrumbs.html
119
+ - _includes/children_toc.html
96
120
  - _includes/footer.html
121
+ - _includes/footer_custom.html
97
122
  - _includes/head.html
123
+ - _includes/head_custom.html
124
+ - _includes/header_custom.html
98
125
  - _includes/icon.html
126
+ - _includes/nav_footer_custom.html
99
127
  - _includes/nav_tree.html
100
128
  - _includes/navbar.html
129
+ - _includes/search_placeholder_custom.html
101
130
  - _includes/search_slot.html
102
131
  - _includes/shells/bare.html
103
132
  - _includes/shells/sidebar-left.html
104
133
  - _includes/shells/sidebar-right.html
105
134
  - _includes/shells/topnav.html
106
135
  - _includes/sidebar.html
136
+ - _includes/toc_heading_custom.html
107
137
  - _layouts/archive-index.html
108
138
  - _layouts/archive.html
109
139
  - _layouts/bare.html
110
140
  - _layouts/default.html
141
+ - _layouts/home.html
142
+ - _layouts/page.html
143
+ - _layouts/post.html
111
144
  - _layouts/search.html
112
145
  - _layouts/sidebar-left.html
113
146
  - _layouts/sidebar-right.html
@@ -189,6 +222,8 @@ files:
189
222
  - assets/css/theme.scss
190
223
  - assets/js/alpine.min.js
191
224
  - lib/jekyll-theme-flow.rb
225
+ - lib/jekyll/theme_flow/nav_generator.rb
226
+ - lib/jekyll/theme_flow/version.rb
192
227
  homepage: https://github.com/gundestrup/jekyll-theme-flow
193
228
  licenses:
194
229
  - AGPL-3.0-or-later