calevans/staticforge-chapternav 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

calevans/staticforge-chapternav

最新稳定版本:1.1.2

Composer 安装命令:

composer require calevans/staticforge-chapternav

包简介

StaticForge Feature: ChapterNav

README 文档

README

What it does: Automatically generates sequential prev/next navigation links for documentation pages based on menu ordering.

Installation

composer require calevans/staticforge-chapternav
php vendor/bin/staticforge feature:setup calevans/staticforge-chapternav

Configuration

Set via siteconfig.yaml file.

# Chapter Navigation Configuration
chapter_nav:
  menus: "2"
  prev_symbol: ""
  next_symbol: ""

Disabling Chapter Navigation

To completely disable chapter navigation processing, either:

  • Set menus: "" (empty string) in your siteconfig.yaml
  • Remove the chapter_nav section from siteconfig.yaml and ensure the CHAPTER_NAV_MENUS environment variable is not set.

How It Works

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.

Example Setup

---
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

Using in Templates

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 %}

Navigation Data Structure

Each page gets:

  • prev - Previous page data (title, url, file) or null
  • current - Current page data
  • next - Next page data or null
  • html - Pre-generated HTML for the navigation

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固