Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions _data/nav/openbolt_5x.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
---
- text: Welcome to Puppet Bolt®
link: bolt.html
- text: Welcome to OpenBolt
link: index.html
items:
- text: Developer updates
link: developer_updates.html
- text: Release notes
link: release_notes.html
- text: Bolt versioning
- text: OpenBolt versioning
link: bolt_versioning.html
- text: Known issues
link: bolt_known_issues.html
- text: Installing Bolt
- text: Installing OpenBolt
items:
- text: Installing Bolt
- text: Installing OpenBolt
link: bolt_installing.html
- text: Run Bolt from a Docker image
- text: Run from a Docker image
link: running_bolt_in_docker.html
- text: Getting started with Bolt
- text: Getting started with OpenBolt
link: getting_started_with_bolt.html
- text: Configuring Bolt
- text: Configuring OpenBolt
items:
- text: Bolt projects
link: projects.html
- text: Inventory files
link: inventory_files.html
- text: Configuring Bolt
- text: Configuring OpenBolt
link: configuring_bolt.html
- text: Logs
link: logs.html
- text: Escalating privilege with Bolt
- text: Escalating privilege
link: privilege_escalation.html
- text: Setting up VS Code for Bolt
- text: VS Code and OpenBolt
link: vscode_and_bolt.html
- text: Running Bolt
- text: Running OpenBolt
items:
- text: Run Bolt
- text: Run OpenBolt
link: running_bolt_commands.html
- text: Run Bolt on network devices
- text: Run OpenBolt on network devices
link: running_bolt_network.html
- text: Scripts
items:
Expand Down Expand Up @@ -88,20 +88,20 @@
link: supported_plugins.html
- text: Writing plugins
link: writing_plugins.html
- text: Using Bolt with Puppet
- text: Using OpenBolt with Puppet/OpenVox
items:
- text: Applying Puppet code
link: applying_manifest_blocks.html
- text: Using Bolt with Hiera
- text: Using OpenBolt with Hiera
link: hiera.html
- text: Connecting Bolt to PuppetDB
- text: Connecting OpenBolt to PuppetDB
link: bolt_connect_puppetdb.html
- text: Bolt Examples
- text: OpenBolt Examples
link: bolt_examples.html
items:
- text: Automating Windows targets
link: automating_windows_targets.html
- text: Deploy a TIG stack with Bolt
- text: Deploy a TIG stack with OpenBolt
link: tig_stack.html
- text: "\U0001F9EA Experimental features"
link: experimental_features.html
Expand Down
92 changes: 92 additions & 0 deletions _includes/child_topics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{%- comment -%}
child_topics.html — auto-generates an overview page's "on this page" list of
sub-topics from the site nav list, so parent-with-link sections don't need a
hand-maintained list of their sub-topics in the page body.

Renders a `<ul>` of child topic links for an overview page whose nav entry
has both `link:` and `items:` (e.g., OpenBolt's "Plans").

For each child: title as a link + first paragraph of the child's rendered
content as a short description. Children that don't resolve to a doc in the
current collection (e.g., missing rake-generated reference pages) render as
a bare link with no description.

Data source: the entry for this page in `_data/nav/<page.nav>.yml`. The
matching `nav_base` (URL prefix) is looked up in `_data/nav_map.yml`.
{%- endcomment -%}

{%- assign nav_base = nil -%}
{%- for entry in site.data.nav_map -%}
{%- if entry.nav_key == page.nav -%}
{%- assign nav_base = entry.base -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}

{%- assign page_subpath = page.url | remove_first: nav_base -%}
Comment on lines +18 to +26

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The child-topics list only renders under /openbolt/latest/. Each collection also publishes at its versioned prefix (/openbolt/5.x/, via the _openbolt_latest symlink), but nav_map has a single base: /openbolt/latest/ for this nav key, so on a 5.x page remove_first: nav_base strips nothing, no nav entry matches, and the include silently emits nothing. Deriving the base from the page's own URL (same technique as sidebar.html) works under both prefixes, and won't need nav_map bookkeeping when 6.x lands:

Suggested change
{%- assign nav_base = nil -%}
{%- for entry in site.data.nav_map -%}
{%- if entry.nav_key == page.nav -%}
{%- assign nav_base = entry.base -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}
{%- assign page_subpath = page.url | remove_first: nav_base -%}
{%- assign nav_collection_dir = page.collection | prepend: '_' | append: '/' -%}
{%- assign page_subpath = page.relative_path | remove_first: nav_collection_dir | replace: '.md', '.html' | replace: '.markdown', '.html' -%}
{%- assign nav_base = page.url | remove: page_subpath -%}

Tested locally: with this, /openbolt/5.x/plans.html renders the full list with version-correct child links (descriptions too, since the site[page.collection] lookup then matches), and /openbolt/latest/ renders exactly as before.


{%- comment -%}
Find the nav entry for the current page. Only matches entries with `items:`,
so pages whose nav entry has `link:` but no children (leaf pages) render
nothing here.
{%- endcomment -%}
{%- assign current_section = nil -%}
{%- for item in site.data.nav[page.nav] -%}
{%- if item.link == page_subpath and item.items -%}
{%- assign current_section = item -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}

{%- if current_section -%}
<ul>
{%- for child in current_section.items -%}
{%- assign child_link_first_char = child.link | slice: 0 -%}
{%- if child_link_first_char == '/' -%}
{%- assign child_url = child.link -%}
{%- else -%}
{%- assign child_url = child.link | prepend: nav_base -%}
{%- endif -%}

{%- assign child_doc = nil -%}
{%- for doc in site[page.collection] -%}
{%- if doc.url == child_url -%}
{%- assign child_doc = doc -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}

{%- comment -%}
Extract the child's first intro paragraph for the description.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd rather that we populate the front matter description field.

Fwiw, the example you linked doesn't autogenerate descriptions. See "running plans" on https://help.puppet.com/bolt/current/topics/plans.htm


Every child page begins with `# Heading` then a plain intro paragraph,
so splitting the rendered HTML on `<p>` skips the `<h1>` and lands on the
first real paragraph.

`child_doc.content` is piped through `markdownify` first because Jekyll
only guarantees it holds rendered HTML for docs that happen to be built
before this page; docs built afterward still hold raw Markdown. Running
`markdownify` normalizes both cases to HTML so the `<p>` split is
deterministic regardless of build order.
{%- endcomment -%}
{%- assign first_para = nil -%}
{%- if child_doc -%}
{%- assign child_html = child_doc.content | markdownify -%}
{%- assign after_first_p = child_html | split: '<p>' -%}
{%- if after_first_p.size > 1 -%}
{%- assign first_para = after_first_p[1] | split: '</p>' | first -%}
{%- endif -%}
{%- endif -%}

{%- comment -%}
Title and description share one `<p>` (separated by a `<br>`) so the theme's
`.vp-doc p { margin: 16px 0 }` doesn't stack two paragraph margins between
them, which would push the description well below the link.
{%- endcomment -%}
<li>
<p><a href="{{ child_url }}">{{ child.text }}</a>{% if first_para %}<br>
{{ first_para }}{% endif %}</p>
</li>
{%- endfor -%}
</ul>
{%- endif -%}
54 changes: 48 additions & 6 deletions _includes/nav-item.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,68 @@
{%- comment -%}
This file renders a single sidebar nav item, which is a list element defined
in `_data/nav/<product_version>.yml`.

The nav item is passed in as `include.item` and can take one of three shapes:

- `items:` only -> collapsible topic header (just expands/collapses)
- `link:` only -> leaf item; display link to page content
- `link:` and `items:` -> collapsible header AND has its own page content
(e.g., OpenBolt's "Plans")

Nested levels are handled by recursing into `include.item.items`.
{%- endcomment -%}
{% if include.item.items %}
{% assign nav_next_level = include.level | plus: 1 %}

{%- comment -%}
It's necessary to pre-render all child items before this item,
because we'll need to peek at their formatting to decide our own.
{%- endcomment -%}
{% capture nav_children %}
{% for child in include.item.items %}
{% include nav-item.html item=child level=nav_next_level %}
{% endfor %}
{% endcapture %}

{%- comment -%}
Compute our item's absolute URL/`nav_item_url`:
- Absolute links ("/openvox-server/latest/http_api_index.html") used as-is
- Relative links ("plans.html") prepend `nav_base` ("/openbolt/latest/")

It's important to compute this AFTER the recursive children capture above:
Liquid's `assign` (below) leaks between includes + theirs would whack ours!
{%- endcomment -%}
{% if include.item.link %}
{% assign nav_link_first_char = include.item.link | slice: 0 %}
{% if nav_link_first_char == '/' %}
{% assign nav_item_url = include.item.link %}
{% else %}
{% assign nav_item_url = include.item.link | prepend: nav_base %}
{% endif %}
{% endif %}

{%- comment -%}
Peek at buffered markup; if any are `is-active`, our formatting must change
{%- endcomment -%}
{% assign nav_has_active = false %}
{% if nav_children contains 'is-active' %}
{% assign nav_has_active = true %}
{% endif %}
{% if include.item.link and nav_item_url == page.url %}
{% assign nav_has_active = true %}
{% endif %}

<div class="group no-transition">
<section class="VPSidebarItem level-{{ include.level }} collapsible{% if nav_has_active %} has-active{% endif %}" data-vp-sidebar-group>
<div class="item" role="button" tabindex="0">
<div class="item"{% unless include.item.link %} role="button" tabindex="0"{% endunless %}>
<div class="indicator"></div>
<h2 class="text">{{ include.item.text }}</h2>
{% if include.item.link %}
<a class="VPLink link link{% if nav_item_url == page.url %} is-active{% endif %}" href="{{ nav_item_url }}" data-vp-sidebar-link data-turbo="true" data-turbo-frame="vp-content-frame" data-turbo-action="advance">
<h2 class="text">{{ include.item.text }}</h2>
</a>
{% else %}
<h2 class="text">{{ include.item.text }}</h2>
{% endif %}
<div class="caret" role="button" aria-label="toggle section" tabindex="0">
<span class="vpi-chevron-right caret-icon"></span>
</div>
Expand All @@ -28,10 +74,6 @@ <h2 class="text">{{ include.item.text }}</h2>
</section>
</div>
{% elsif include.item.link %}
{%- comment -%}
Links starting with '/' are already absolute site paths. Prepending nav_base (which also
starts with '/') would produce a broken double-prefix like /openvox/latest//other/page.html.
{%- endcomment -%}
{% assign nav_link_first_char = include.item.link | slice: 0 %}
{% if nav_link_first_char == '/' %}
{% assign nav_item_url = include.item.link %}
Expand Down
72 changes: 0 additions & 72 deletions docs/_openbolt_5x/bolt.md

This file was deleted.

2 changes: 2 additions & 0 deletions docs/_openbolt_5x/bolt_examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ blog](https://puppet.com/search/?query=bolt&page=1&configure%5BhitsPerPage%5D=20

> **Note:** Do you have a real-world use case for Bolt that you'd like to share? Reach out to us in the #bolt
channel on [Slack](https://slack.puppet.com).

{% include child_topics.html %}
18 changes: 9 additions & 9 deletions docs/_openbolt_5x/bolt_versioning.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
---
layout: default
title: Bolt versioning
title: OpenBolt versioning
---

# Bolt versioning
# OpenBolt versioning

Bolt follows [semantic versioning](https://semver.org/) guidelines.
OpenBolt follows [semantic versioning](https://semver.org/) guidelines.

This system uses an "x.y.z" pattern, where "x" is the number of a major release,
"y" indicates a minor release that introduces new features but does not include
breaking changes, and "z" reflects a bug fix release.


## Bolt API
## OpenBolt API

The 2.0 series of Bolt is stable and will be free of breaking changes to its
The 5.0 series of OpenBolt is stable and will be free of breaking changes to its
public API. In general this means that plans, inventory and config tested with
any 2.y series release of Bolt will continue to work when used with a later 2.y
series release. You can expect the following types of changes in the 2.0 series:
any 5.y series release of OpenBolt will continue to work when used with a later 5.y
series release. You can expect the following types of changes in the 5.0 series:

- New keys in JSON format output.
- Differences in log output and human format output.
Expand All @@ -27,8 +27,8 @@ series release. You can expect the following types of changes in the 2.0 series:
- Versions of bundled modules will be updated and might include breaking
changes.

## Bolt releases
## OpenBolt releases

For the 2.y series of Bolt we do not plan to backport bug fixes to any
For the 5.y series of OpenBolt we do not plan to backport bug fixes to any
previously released version. You are encouraged to upgrade frequently and use
the latest release.
Loading