Free SEO audit for new clients — claim yours
Home/Blog/SEO/Table of Contents and Jump Links for SEO
SEO

Table of Contents and Jump Links for SEO

Table of Contents and Jump Links for SEO
Table of contents
  1. What a table of contents does for readers and for Google
  2. When a table of contents is worth adding to a page
  3. Anchor IDs and heading wording that make jump links work
    1. Rules for IDs that last
    2. Heading wording matters more than the markup
  4. How Google sends searchers to a section of your page
  5. Sticky or inline: choosing where the TOC lives
    1. Fixed headers and the hidden-heading problem
  6. Making the table of contents work on mobile
  7. Plugin or hand-built: what to check either way
    1. A worked example of an inline TOC on a long guide
  8. Questions people ask about tables of contents and SEO
    1. Does a table of contents improve rankings?
    2. Will a TOC make Google show jump links for my page?
    3. Should the TOC include H3 headings?
    4. Is a collapsed TOC bad for SEO?
    5. Can I use a TOC on product or service pages?
  9. Where to start with jump links on your own site
  10. Further reading on table of contents SEO
  11. Sources for this table of contents and jump links guide

A lot of site owners add a table of contents to their blog posts because they heard it “helps SEO.” Install a plugin, tick a box, and Google will start showing those handy section links under your result. Or so the story goes.

The truth is more useful than the myth. A table of contents (TOC) is mainly a tool for readers. It helps people see what’s on a long page and jump to the part they need. Google can sometimes use the same structure to send searchers straight to a section of your page, but there is no switch you can flip to make that happen, and a badly built TOC can actually break those links.

Let me explain when a TOC is worth adding, how to set up anchor IDs and headings so the links work, what Google says about links that jump to a section, whether to choose a sticky or inline TOC, how to handle mobile, and whether to use a plugin or build it by hand.

What a table of contents does for readers and for Google

A table of contents is a list of links near the top of a page, each pointing to a section further down. Each link uses a jump link (also called an anchor link), which is a URL ending in # plus the ID of a heading, such as /guide/#pricing. Clicking it scrolls the browser to that heading.

Nielsen Norman Group, a respected user-experience research firm, published a detailed design guide to tables of contents in October 2023. It defines a TOC as “an ordered list of clickable headings corresponding to the content sections on the page,” and lists benefits like a quick overview, shareable links to sections, help discovering content lower on the page and possible section links in search results.

For SEO, the benefits are indirect but real:

  • Better match to intent. A reader who wants one answer can reach it in one tap instead of scrolling past 2,000 words and leaving.
  • Section-level links you can share. Your support team, social posts and other sites can link to #returns-policy instead of the whole page.
  • Clearer page structure. A TOC forces you to write clear, descriptive headings, which helps both readers and search engines understand the page.
  • Possible section links in search results, which I cover below. These are a bonus, not a promise.

What a TOC does not do is add ranking power by itself. If the headings it lists are vague or the content under them is thin, the TOC simply shows that more clearly.

When a table of contents is worth adding to a page

Not every page needs one. A TOC on a 600-word post is clutter. Here is how I suggest deciding:

Page typeAdd a TOC?Why
Long guide (roughly 1,500+ words, 5+ sections)YesReaders come with different questions and want to skip ahead
Reference page (glossary, specs, policies)YesPeople look up one item, not read top to bottom
FAQ or help-center article with many questionsYesEach question is its own destination
Product comparison or “best of” listOftenJump links to each product or verdict help scanners
Short blog post or news itemNoAdds clutter above the content
Product pageRarelyTabs or short sections usually work better
Service or landing pageRarelyYou want people to read the pitch and act, not jump away

A simple test: would a reasonable reader want to skip to a specific section? If yes, add a TOC. If the page is meant to be read in order, skip it. If you’re deciding how long a page should be in the first place, our guide on setting content length from the SERP helps, and our piece on when long-form content wins covers the trade-offs of depth.

This is the part most plugins handle for you, and the part most likely to go quietly wrong. Every TOC link needs a heading with a matching id attribute.

<nav aria-label="On this page">
  <h2>On this page</h2>
  <ol>
    <li><a href="#when-to-prune">When to prune apple trees</a></li>
    <li><a href="#tools-you-need">Tools you need</a></li>
  </ol>
</nav>

<h2 id="when-to-prune">When to prune apple trees</h2>

Rules for IDs that last

  • Unique on the page. MDN’s reference on the id attribute says an ID must be unique within the entire document. Two sections both called “Pricing” need different IDs.
  • No spaces. MDN also says ID values must not contain whitespace. Use hyphens.
  • Short, readable and lowercase. #tools-you-need is easy to share; #h-the-complete-list-of-every-tool-you-will-ever-need-2026 is not.
  • Stable. If a plugin builds IDs automatically from heading text, editing a heading changes the ID and breaks every link anyone ever shared to that section. For important sections, set the ID by hand and leave it alone.
  • Don’t start with a number if you can avoid it. MDN recommends IDs that are valid CSS identifiers so they don’t need escaping in code.

Heading wording matters more than the markup

The TOC shows your headings as a list, so weak headings become very obvious. “Step 3” or “More info” tells a reader nothing. Nielsen Norman Group recommends that TOC link labels match the section headings exactly, keeps headings succinct, and advises against skipping any headings in the list. I agree on all three.

Google’s sitelinks documentation makes a related point about headings in general:

“Make sure that the text you use as your page titles and in your headings is informative, relevant, and compact.”

— Google Search Central, Sitelinks in Google Search results

A clean heading outline also helps people using screen readers, who often move around by headings. Our lesson on headings and page structure covers the basics, and our guide to multiple H1 tags explains the one-H1 question.

How Google sends searchers to a section of your page

There are a few ways Google can link to a specific part of a page instead of the top. None of them can be forced, but you can avoid breaking them.

FeatureWhat the searcher seesWhat it relies on
“Read more” deep linksA link inside the snippet that goes to a section of the pageVisible, well-structured content; working hash fragments
Section links under a resultSmall links to sections of the same page, sometimes shown under a resultClear headings and jump links; Google decides when to show them
Highlighted text fragmentsClicking a result scrolls to and highlights a passageBrowser support for text fragment URLs (#:~:text=)

Google’s snippet documentation gives specific advice for “Read more” deep links. It says content should be immediately visible to a human, not hidden behind an expandable section or tabs. It also warns about scripts that move the page:

“Avoid using JavaScript to control the user’s scroll position on page load.”

— Google Search Central, Control your snippets in search results

The same page adds that if you use the history API or change window.location.hash on page load, you must not remove the hash fragment from the URL, because that breaks deep linking. This matters for TOCs, because some “smooth scroll” plugins do exactly that: they intercept the click, scroll with JavaScript and strip the #section from the address bar so the URL looks clean.

The third row, text fragments, works even without a TOC, because the browser finds the text itself. If you see URLs with #:~:text= in your analytics, our guide to text fragment links from AI features explains what they mean.

Section links are part of the broader sitelinks family. If you want your site to earn more of them, our guide on how to earn Google sitelinks covers the site-wide side.

Sticky or inline: choosing where the TOC lives

You have three common layouts. Each has trade-offs.

  • Inline TOC sits in the main content, just below the title or intro. It’s simple, works on every screen size and needs no JavaScript.
  • Sticky sidebar TOC sits in a left or right column and stays on screen as you scroll, often highlighting the current section.
  • Collapsible sticky TOC is a small bar or button that stays fixed and opens the list when tapped. It’s common on mobile.

Nielsen Norman Group’s guidance is specific here. It recommends that TOCs in a side rail be sticky, ideally showing which section you’re in, while TOCs placed in the main body should not be sticky:

“we recommend a nonsticky implementation of a table of contents when placed within the main body.”

— Nielsen Norman Group, Table of Contents: The Ultimate Design Guide

The reason is that a sticky box in the content area can be confused with the site’s main navigation. NN/g also warns about right-rail placement, where users often ignore anything that looks like an ad, so a right-rail TOC should be plain and clearly labeled.

LayoutBest forWatch out for
Inline, near the topMost blogs; the safe defaultLong intros push it below the fold; add back-to-top links on long pages
Sticky left railDocumentation, long reference pages on desktopNeeds a mobile fallback; takes width from content
Sticky right railWide layouts with spare space“Right-rail blindness”; keep it plain
Collapsible sticky barMobile versions of long guidesMany users don’t notice it; it covers content

Fixed headers and the hidden-heading problem

If your site has a sticky header, clicking a TOC link can scroll the heading underneath it, so the reader lands just below the title they wanted. The fix is one line of CSS. The scroll-margin-top property, which MDN lists as widely available across browsers since April 2021, adds space above the target when the browser scrolls to it:

h2[id], h3[id] { scroll-margin-top: 80px; } /* match your header height */

This is far better than a JavaScript offset script, because it keeps the browser’s normal jump behavior and the hash in the URL.

Making the table of contents work on mobile

Mobile is where most TOCs get awkward. Side rails don’t fit, and a long inline list can fill the whole first screen. NN/g notes that common mobile options include moving the TOC into the body, turning sections into accordions, or using a collapsible sticky version, and that in its testing many users failed to notice the collapsible sticky kind.

Here is the mobile setup I suggest for most content sites:

  1. Keep the intro short, two to four short paragraphs, so the TOC appears on the first or second screen.
  2. Show the TOC inline with a clear label such as “On this page” or “In this guide.”
  3. Collapse only if it’s long. If the list has more than about eight items, show the first few and a “Show all sections” button. Keep all links in the HTML, not loaded on tap.
  4. Make each link easy to tap. Give list items enough height and spacing that a thumb doesn’t hit the wrong one.
  5. Add “Back to top” links or a small floating button on very long pages.
  6. Never put the content itself in accordions just to make the page look shorter, if you want Google to deep-link to those sections. Google says deep-link content should not be hidden behind expandable sections.

That last point is easy to get wrong. A collapsed TOC is fine. Collapsed sections of content are a different matter, both for deep links and for readers. Our guide to mobile navigation and hamburger menus covers how Google handles content that needs a tap to appear.

Also watch layout shift. A TOC that loads after the content and pushes everything down hurts Cumulative Layout Shift, one of the Core Web Vitals. Render it in the initial HTML or reserve its space.

Plugin or hand-built: what to check either way

For most WordPress sites, a TOC plugin is fine. For custom sites, a few lines of template code are enough. Whatever you choose, check these points:

CheckGood signBad sign
Links in the HTMLTOC visible in “View source”TOC built only by JavaScript after load
Hash kept in URLAddress bar shows #section after clickingHash removed by a smooth-scroll script
Stable IDsCustom IDs can be set and stay putIDs change when a heading is edited
Heading levelsLets you include H2 only, or H2 and H3Pulls in every H4 and sidebar heading
WeightSmall CSS, little or no JavaScriptLoads a large script on every page, even without a TOC
AccessibilityUses a <nav> with a label and a real listDiv soup with click handlers

A hand-built TOC is often simpler than people think. Many static site generators and headless CMSs can generate it at build time from the headings, with no JavaScript in the browser at all. If you’re on WordPress and worried about plugin weight, our guide to WordPress speed optimization explains how to check what a plugin loads.

A worked example of an inline TOC on a long guide

Example (hypothetical): A 3,200-word guide on pruning apple trees has 9 H2 sections. In Search Console it gets 18,000 impressions a month across about 400 queries. The top queries include “when to prune apple trees” (about 4,000 impressions), “apple tree pruning tools” (about 1,500) and “how to prune an overgrown apple tree” (about 1,200).

The owner adds an inline TOC with the 9 H2s, rewrites two vague headings (“Getting the timing right” becomes “When to prune apple trees”; “What you’ll need” becomes “Tools you need for pruning”) and sets stable IDs for each. The heading rewrites matter more than the TOC itself, because they now match how people search.

What would I measure? Not just rankings. I would track clicks and CTR on those three queries, scroll depth or section-level engagement in analytics, and whether any deep links appear in results. Our guide on measuring on-page SEO changes explains how to compare fairly. If deep links never appear, the change is still worth it if readers find their answer faster.

Questions people ask about tables of contents and SEO

Does a table of contents improve rankings?

Not directly. It helps readers navigate and encourages clearer headings. Any ranking benefit comes from a better page, not from the TOC itself.

It can help, but there’s no guarantee. Google decides when to show section links or “Read more” deep links. Keep content visible, IDs stable and hash fragments intact to give it the best chance.

Should the TOC include H3 headings?

Only if the H2 list alone is too vague. For most posts, H2s are enough. Including every H3 makes the list long and harder to scan.

Is a collapsed TOC bad for SEO?

A collapsed TOC is generally fine if all links are in the HTML. What to avoid is hiding the actual content sections behind accordions or tabs when you want Google to link to them.

Can I use a TOC on product or service pages?

You can, but it rarely helps. Those pages are meant to lead to an action, and a list of jump links can distract from it. Tabs or short, clear sections usually work better.

In brief: add a table of contents to long pages where readers want to skip ahead, write headings that say exactly what each section covers, give them stable IDs, and keep the page’s hash fragments and visible content intact so Google can link into it. Treat any jump links in search results as a bonus.

A good first step is to pick your five longest posts with the most impressions and add an inline TOC to each, fixing weak headings as you go. If you’d like help restructuring long content or rewriting headings so they match real searches, our content writing team can help. Get in touch for a quote.

Further reading on table of contents SEO

  1. Nielsen Norman Group: Table of Contents: The Ultimate Design Guide
  2. Google Search Central: Control your snippets in search results
  3. Google Search Central: Sitelinks in Google Search results
  4. MDN Web Docs: id attribute
  5. MDN Web Docs: scroll-margin-top
  6. Ahrefs: On-Page SEO Checklist
Rohit Choudhary
Written byRohit ChoudharyCo-Founder, My SEO Experts

Rohit Choudhary is the co-founder of My SEO Experts and has more than 14 years of hands-on experience in SEO, paid advertising and digital marketing. Since starting out in 2011 he has helped hundreds of businesses grow through practical, data-driven search strategies, and he also serves as a consulting Digital Marketing Director for several US-based companies.

Keep reading

Related articles

Ready to grow your business online?

Get a free, no-obligation proposal tailored to your goals and budget.

CallFree Quote