Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/carmopereira/carmo-h123-vertical-menu/archive/refs/heads/main.zipA vertical navigation menu WordPress block that automatically generates a hierarchical table of contents from H2 and H3 headings on your page, with active highlighting and smooth scrolling.
Description
The Vertical Table of Contents block creates an elegant, fixed-position navigation menu that dynamically scans your page content for H2 and H3 heading elements. It builds a hierarchical menu structure that makes it easy for visitors to navigate long-form content.
Key Features
- Automatic Detection: Scans the page and finds all H2 and H3 headings
- Hierarchical Structure: Creates a nested menu showing the relationship between main sections (H2) and subsections (H3)
- Active Highlighting: Automatically highlights the current section as users scroll through the page
- Smooth Scrolling: Clicking any menu item smoothly scrolls to that section
- Sticky Navigation: Remains visible as users scroll down the page
- Responsive: Optimized for desktop viewing
Perfect For
- Long blog posts and articles
- Documentation pages
- Tutorial content
- Research papers and white papers
- Any content with clear hierarchical structure
Installation
- Upload the plugin files to the
/wp-content/plugins/carmo-h123-vertical-menudirectory, or install the plugin through the WordPress plugins screen directly. - Activate the plugin through the 'Plugins' screen in WordPress
- Add the "Carmo H123 Vertical Menu" block to any post or page
- The block will automatically detect H2 and H3 headings in your content
Development
Prerequisites
- Node.js and npm
- WordPress development environment
Setup
npm install
npm run build
Build Commands
npm run build- Build production filesnpm run start- Start development mode with watchnpm run plugin-zip- Create a zip file for distribution
Frequently Asked Questions
Does this work with Heading blocks?
Yes! The block scans the entire page content for H2 and H3 HTML elements, so it works with WordPress Heading blocks and any other content that uses standard heading tags.
Can I customize the styling?
The block includes clean, minimal styling that adapts to most themes. You can add custom CSS to further customize the appearance.
Does it work on mobile devices?
The block is optimized for desktop viewing. On mobile devices, you may want to use WordPress's built-in Table of Contents block instead.
What if my headings don't have IDs?
The block automatically generates IDs for headings that don't have them, ensuring smooth scrolling works for all content.
Changelog
0.1.0
- Initial release
- Automatic H2 and H3 detection
- Hierarchical menu structure
- Active section highlighting
- Smooth scroll navigation
License
GPL-2.0-or-later - see LICENSE file for details.
Contributors
The WordPress Contributors