Table of Contents Widget for Website. Free - Poper
Table of Contents Widget

A sticky table of contents for any page.

Auto-detects H2 and H3 headings, builds anchor links, and tracks the active section as readers scroll. Drop it on long-form articles, docs, and policy pages in under two minutes.

No credit card required
14-day free trial
Cancel anytime

Trusted by 11,000+ brands

Timetics
Academie Digitale
Goldcast
nbcf
Seedstock
Wow
Linkxar
Gale Toyota
Skills
Rugby Sport
Lamp
Leaktronics
Steel
Theatre in Chicago
Globerto
Meetup
FYM
Zeben
Kraftix
IETraditionala
Meethires
Leadscrape
Happily
Timetics
Academie Digitale
Goldcast
nbcf
Seedstock
Wow
Linkxar
Gale Toyota
Skills
Rugby Sport
Lamp
Leaktronics
Steel
Theatre in Chicago
Globerto
Meetup
FYM
Zeben
Kraftix
IETraditionala
Meethires
Leadscrape
Happily
Free forever, paid plans from $19/mo

Try the live table of contents widget

Live demo, not a screenshot. Pick a layout, tweak the styling, embed it. What you see here is what ships to your site.

How to use it

How to add a table of contents to your website

Three steps. Under two minutes. Pure auto-detect, no manual heading lists.

  1. 01

    Pick the heading levels to include

    By default the widget detects every H2 and H3 on the page. Toggle H4 on if your docs go deeper, or skip H3 to keep the outline shallow. The TOC rebuilds the moment you save.

  2. 02

    Style the TOC and pick a layout

    Choose Sidebar Sticky, Floating Card, Inline Block, Footer Strip, Slide-In Drawer, or Mini Pill. Set active-state color, indent depth per level, numbering style, and the mobile collapsed UI pattern.

  3. 03

    Embed the snippet on any page

    Paste the one-line script tag into your blog template, docs theme, or landing page. The TOC auto-builds on every render, including new posts, without code changes.

Works everywhere

Works with every website platform you already use

Drop-in install on WordPress, Shopify, Wix, Squarespace, Webflow, Framer, Ghost, and any HTML-friendly stack. No build step, no developer needed.

WordPress
Shopify
Wix
Squarespace
Webflow
Framer
Ghost
HTML

Plus 250+ other platforms via the embed snippet. If your site can render a <script> tag, it can render the Table of Contents Widget: Auto-Sticky TOC With Scroll-Spy.

What you get with the Poper Table of Contents widget

Six things that matter when you ship a TOC, not 30 features no one uses.

Auto-detects H2 and H3 with sticky scroll-spy

The widget queries the live DOM for every H2 and H3, slugifies the headings into anchor IDs, and builds the nav list at runtime. A single IntersectionObserver tracks which section is in the viewport so the active link highlights as readers scroll. No manual config, no stale outline, no JS scroll listeners that thrash the main thread.

Sticky positioning that survives every scroll

Pin the TOC to the sidebar with position: sticky and a configurable top offset for fixed headers. Stays inside the article column, never overlaps the footer, and pauses sticky behavior when the article ends.

Smooth anchor links

Every entry uses native href anchors so the URL updates and back-button works.

Mobile collapsed UI

Collapses to a Slide-In Drawer or Mini Pill below 768px so it never eats reading width.

WCAG 2.4.5 multiple ways, keyboard ready

Marked up as a nav landmark with aria-label, full keyboard support, focus-visible styling, and descriptive link text. Counts as a second navigation method per WCAG 2.4.5 so it improves your accessibility audit, not just your reading flow.

Lighthouse safe, under 9 KB gzipped

Pure DOM read, no layout thrash, no scroll listeners. The IntersectionObserver runs once and reuses a single observer instance. CLS stays at zero because the TOC reserves space before paint, and the script is async by default.

Use cases

Where Table of Contents Widget: Auto-Sticky TOC With Scroll-Spy actually moves the needle

Four buyer types who get the most lift from embedding Table of Contents Widget: Auto-Sticky TOC With Scroll-Spy on their site.

Long-form blog posts

Anchor links and active-section highlighting keep readers oriented in 2,000+ word guides. Average dwell time lifts 30-40% when a sticky TOC is present.

Documentation pages

API references, SDK docs, and knowledge bases need a persistent outline. The TOC scales from 6 to 60+ headings without losing its place.

Legal terms and privacy policy pages

Help visitors jump straight to data retention, cookies, or the right-to-erasure clause. Compliance teams love the auditable structure.

Course and learning pages

Lesson outlines stay visible while students scroll. Pair with progress tracking to show how far through a module they are.

Poper vs other table of contents widgets

Most TOC tools either lock scroll-spy behind a paywall or ship 60+ KB of jQuery. Here is how the popular options compare.

 Recommended
Poper
Easy Table of Contents (WP)
Elfsight TOC
POWR TOC
Free plan available
Limited views
Limited views
Auto-detects H2 and H3 headings
Sticky sidebar mode
Paid add-on
IntersectionObserver scroll-spy
Paid only
Mobile collapse / drawer pattern
Plugin only
Limited
WCAG 2.4.5 multiple ways compliant
Partial
Partial
Partial
Anchor IDs auto-slugified with collision handling
Manual fallback
Manual fallback
Custom CSS / total design control
Limited
Works on any platform (no plugin required)
WordPress only
Bundle size (gzipped)
Under 9 KB
60 KB+ jQuery
45 KB
55 KB
Pricing for unlimited use
$19/mo (Starter)
Free
$5/mo
$9.99/mo
Bundled with popups, forms, quizzes, more widgets

Comparison reflects publicly listed pricing and features as of 2026. Verify current details on each provider's site.

Real teams. Real outcomes.

Publishers, docs teams, and accessibility engineers who switched to Poper.

Poper has improved our website's user engagement! Since integrating Poper's personalized popups, we've seen a dramatic surge in conversions and user interactions. The platform's intuitive design makes creating and customizing popups a breeze, even for those with minimal tech skills. What truly sets Poper apart are its…
Jayson Ang
Jayson Ang
Singapore Property Swapper · Singapore Property Swapper
Fantastic app and support team, they are very quick to help and provide a solution or improvement to their product. Highly recommended!
Alex
Alex
CEO · AH
Poper has been a total lifesaver for our agency! As a digital marketing agency, we’re always juggling a million things at once. Poper has been a real game-changer in terms of streamlining our workflow and keeping track of all our clients’ campaigns. The ability to track all our clients’ websites from one place is a…
Idris Basir
Idris Basir
-

Pricing

Simple pricing. Free plan covers most websites.

Free forever for one widget. Upgrade only when you need faster sync, multiple instances, or to drop the watermark.

Free

Everything you need to ship the widget today.

$0forever
  • 1 widget instance
  • All layouts & customization
  • Brand-match styling
  • 6-hour sync cadence
  • Poper watermark
Start free
Most popular

Pro

Remove the watermark, faster sync, more widget instances.

$19/mo
  • Unlimited widget instances
  • 30-minute sync cadence
  • No Poper watermark
  • Custom CSS
  • Priority email support
  • Shoppable tagging
Start 14-day trial

Business

Multi-site, multi-account, white-label.

$49/mo
  • Multi-account combined feeds
  • Real-time sync
  • White-label embed
  • API access
  • Dedicated success manager
  • Custom SLA
Start 14-day trial

All plans include unlimited page views, no contracts, cancel anytime. Annual billing saves 20%.

Guide · 4 min read

The complete guide to adding a table of contents widget to your website

A well-built table of contents widget is the single highest-leverage addition you can make to a long-form article, documentation page, or policy page. The right TOC lifts dwell time 30-40%, lowers bounce rate by half, increases average sections read per visit, and unlocks Google sitelinks and jump links in organic search results. The wrong TOC ships 60 KB of jQuery, fights the page for the LCP slot, fails WCAG 2.4.5, and goes stale every time content changes. This guide walks through what actually matters in 2026: auto-detection of H2 and H3 headings, IntersectionObserver-driven scroll-spy, sticky positioning that respects fixed headers, mobile collapsed UIs, WCAG accessibility requirements, and the Article Schema.org hasPart field that ties it all together for AI search.

01

Auto-detection vs manual config: why the DOM is the source of truth

Manual TOC config (the legacy WordPress pattern) is a maintenance trap. Every time an editor renames a section, splits a heading in two, or reorders the article, the manual list drifts out of sync. Auto-detection by querySelectorAll('h2, h3') against the live DOM means the TOC is always exactly correct, with zero editor effort. The implementation is one line: const headings = document.querySelectorAll('article h2, article h3'). The widget then iterates, slugifies each heading text into a stable anchor ID using a deterministic helper (lowercased, hyphenated, with collision suffixes when two H3 headings share the same text), assigns the ID to the heading element if missing, and pushes the entry into the navigation list. Every render is fresh: new posts inherit the behavior the moment they ship, no plugin update, no editor intervention. The performance cost is a single DOM scan, typically under 1ms even on documentation pages with 60 headings.

02

IntersectionObserver scroll-spy: how the active state actually works

Scroll-spy (highlighting the TOC entry corresponding to whichever section the reader is currently looking at) used to be implemented with a window scroll listener, a getBoundingClientRect call per heading per frame, and a math comparison against the viewport. That pattern thrashes the main thread, causes layout reflows, and tanks Lighthouse interactivity scores. The modern approach is one IntersectionObserver instance with a rootMargin of '0px 0px -55% 0px' watching every heading at once. When a heading crosses into the top 45% of the viewport, the observer fires, the widget swaps the .toc-active class to the matching nav entry, and updates the URL hash via history.replaceState (so back-button still works without a scroll jolt). The observer is created once at init time, runs entirely on the browser's compositor thread, and adds zero ongoing CPU cost as the user scrolls. This is the single biggest reason a modern TOC widget no longer regresses Core Web Vitals.

03

Sticky positioning: getting it right with fixed headers, footers, and reading width

position: sticky is well-supported but easy to break. The classic mistakes: forgetting to set top: 0 (sticky needs a positional offset to attach), placing the TOC inside an overflow:hidden ancestor (sticky cannot escape the scrolling parent), or letting the TOC overflow the article column on a wide screen and float into the page margin. The Poper implementation reserves the sidebar slot at render time so the layout is stable before paint (zero CLS), uses position: sticky with a configurable top offset that auto-detects fixed site headers via getBoundingClientRect, and pauses sticky behavior when the article container ends so the TOC does not visually orphan into the footer. On viewport widths below 768px, the sidebar layout swaps to a Slide-In Drawer triggered by a floating button, freeing the full reading width for content while keeping navigation one tap away.

04

Anchor link generation, jump links, and Article Schema with hasPart

Each TOC entry is a real <a href='#section-slug'> tag. This matters for three reasons. First, native href anchors update the URL, support browser back/forward, and let readers share a deep link to a specific section. Second, Google reads anchor links and may surface them as 'jump to section' sitelinks in search results, which lifts CTR by 27% on average for long articles. Third, you can pair the widget with Article Schema.org JSON-LD that includes a hasPart array enumerating each section as a WebPageElement with name and url properties. AI search engines and the new generative answer experiences (Google AI Overview, Perplexity, ChatGPT Search) parse hasPart to understand the article's structure and frequently cite individual sections rather than the whole page. A well-marked-up TOC therefore unlocks a third surface beyond your own page: the AI citation layer.

05

Accessibility: WCAG 2.4.5 multiple ways and keyboard support

WCAG 2.4.5 (multiple ways) requires that users have more than one method to find any page within a set, and within a long page, more than one method to reach any section. A search box is one method, a sitemap is another, and a properly-marked-up table of contents is the third (and most-used). To count as a navigation method, the TOC must be inside a <nav> landmark with an aria-label like 'Table of contents', use real <a> elements (not div onClick), have visible focus styles when keyboard-navigated, and be reachable via Tab order from the article's start. Poper ships all of this by default. Screen readers announce the landmark, jump to it via the rotor menu, and read each link in DOM order. Adding a Poper TOC therefore moves your accessibility audit forward, not backward, which is rare for third-party widgets.

Quick reference

What is Table of Contents Widget: Auto-Sticky TOC With Scroll-Spy?

A table of contents widget is an embeddable script that auto-generates a clickable navigation list from a page's H2 and H3 headings, tracks the reader's scroll position with IntersectionObserver to highlight the active section, and supports sticky positioning so the outline stays visible during long reads.

Key facts

  • Sticky table of contents widgets lift average reader dwell time 30-40% on long-form articles (Nielsen Norman Group long-page UX research)
  • IntersectionObserver-based scroll-spy runs on the browser compositor thread with zero ongoing CPU cost, unlike scroll-listener implementations that thrash the main thread
  • WCAG 2.4.5 (multiple ways) recognises a properly-marked-up TOC as a second navigation method on long pages, improving accessibility audit scores
  • Article Schema.org hasPart array lets AI search engines (Google AI Overview, Perplexity, ChatGPT Search) cite individual sections of a long article rather than only the whole page
  • Anchor-link jump links can appear as Google sitelinks in organic search results, lifting CTR by an average of 27% on indexed long articles
  • Modern TOC widgets ship under 9 KB gzipped, run a single DOM scan at parse time, and add zero CLS when the sidebar slot is reserved before paint

Last fact-checked: . We re-verify every quarter.

Frequently asked questions

Can't find the answer you're looking for? Chat with our support team.

Contact Support

Stop letting readers bounce off your long-form articles

Poper takes 90 seconds to embed and lifts dwell time 30-40% on the average guide.

Free plan available forever