

The "Table of Contents" block in the Gutenberg editor.
Jalandhar Table of Contents generates an SEO-friendly table of contents (TOC) from the headings in your post or page. Instead of scrolling through long-form content, readers can jump straight to the exact section they came for. The plugin works automatically upon activation, or lets you place your TOC precisely where you want using a shortcode, a custom Gutenberg block, or a widget.
Every link points to a real, semantic anchor on the heading itself, and the entire TOC is wrapped in a proper <nav> landmark – so it is just as valuable to search engine crawlers and screen readers as it is to human visitors. Long-form guides, tutorials, recipes, FAQs, and review posts all rank and read better with a well-structured table of contents.
<ul>/<li> (or <ol>/<li>) lists inside a <nav> landmark with clean anchor links that search engines may use for jump-to-section links in results.[jptoc] shortcode, the Gutenberg “Table of Contents” block, a widget, or the classic editor toolbar button.example.com/faq/#How_Do_This) instead of random IDs, with options for lowercase conversion and dash separation.aria-expanded states on toggles and descriptive aria-label attributes on <nav> landmarks.To automatically insert a table of contents into your posts, enable “Auto Insert Table of Contents” under the plugin’s “Auto Insert” settings tab, then choose which post types should get one.
Supported automatic positions:
If you prefer placing your table of contents manually, use any of these methods:
[jptoc] shortcode anywhere in your contentBy default, each heading’s anchor is generated from its text (e.g., #How_Do_This), keeping your URLs human-readable. Under the “Misc.” settings tab, in the “Hash” section, you can choose the anchor format (as heading, as heading without transliterate, or a counter such as #jptoc1), convert anchors to lowercase, and replace underscores with dashes.
Note: For non-English websites using the “As heading” anchor format, enabling the Intl PHP extension ensures proper transliteration of anchors.
Jalandhar Table of Contents has been tested for compatibility with:
jptoc_before and jptoc_afterAdd custom HTML immediately before or after the table of contents.
add_filter('jptoc_before', function ($before) {
return '<p>Custom text before TOC.</p>' . $before;
});
jptoc_shortcode_tagChange the shortcode tag from the default [jptoc].
add_filter('jptoc_shortcode_tag', function ($tag) {
return 'toc';
});
jptoc_heading_idCustomize the anchor ID generated for individual headings.
add_filter('jptoc_heading_id', function ($id, $label) {
return $id;
}, 10, 2);