What it does: Automatically generates sequential prev/next navigation links for documentation pages based on menu ordering.
composer require calevans/staticforge-chapternav
php vendor/bin/staticforge feature:setup calevans/staticforge-chapternavSet via siteconfig.yaml file.
# Chapter Navigation Configuration
chapter_nav:
menus: "2"
prev_symbol: "←"
next_symbol: "→"To completely disable chapter navigation processing, either:
- Set
menus: ""(empty string) in yoursiteconfig.yaml - Remove the
chapter_navsection fromsiteconfig.yamland ensure theCHAPTER_NAV_MENUSenvironment variable is not set.
Chapter Navigation uses the menu ordering from MenuBuilder to create sequential navigation between pages. Pages that appear in the configured menus automatically get prev/next links based on their menu position.
---
title = "Quick Start Guide"
menu = 2.1
template = "docs"
------
title = "Configuration Guide"
menu = 2.2
template = "docs"
---Results:
- Quick Start Guide (2.1): Shows only "Next →" link to Configuration Guide
- Configuration Guide (2.2): Shows "← Prev" to Quick Start
The chapter navigation HTML is automatically generated. To display it in your template:
{% if features.ChapterNav.pages[source_file] is defined %}
{% for menu_num, nav_data in features.ChapterNav.pages[source_file] %}
{{ nav_data.html|raw }}
{% endfor %}
{% endif %}Each page gets:
prev- Previous page data (title, url, file) or nullcurrent- Current page datanext- Next page data or nullhtml- Pre-generated HTML for the navigation