Table of Contents Plugin for Squarespace 7.1
Here’s how to use this table of contents plugin:
Copy the code below
Paste it into a new code block on any page/post
Get a TOC like the one you see just below!
Table of Contents
Looking for a TOC that only shows H2 headings?
I got you! Click here.
What Is the Table of Contents Plugin?
This Squarespace table of contents (TOC) plugin is a simple piece of code you can use in a code block element for any page or blog post.
It auto-generates a clickable list of your post's headings (like H2s, H3s, H4s). So when someone clicks a section, it scrolls them right to that part of your blog post. Very scroll-savvy. Very UX-friendly.
Why Use A Table of Contents Plugin?
There’s no native TOC feature in Squarespace. So why bother using one?
Here are the biggest reasons:
Makes long posts easier to navigate
Better UX — helps readers scan easily
Boosts your SEO by improving structure and accessibility
Encourages more on-page time (Google loves that)
Also, it just looks clean.
How to Use This Squarespace Plugin
Paste the entire code (HTML + JS + CSS) into a Code Block at the top of any blog post
The TOC will only show up if your post includes at least one
<h2>
,<h3>
or<h4>
The “Show/Hide” button lets visitors toggle the full table on and off
And that’s it! No backend CSS or extra technical steps.
How to Customize This Dang Plugin
✏️ Edit the Button Color
Update the #toggle-toc
button by changing the border and text color here:
#toggle-toc {
border: 1px solid #27A2B7;
color: #27A2B7;
}
#toggle-toc:hover {
background: #27A2B7;
}
Swap in your own brand hex code (or play around with transparency, gradients, whatever you want).
🎨 Adjust TOC Styling (optional)
You can customize:
The container background:
#toc-container { background: #f8f9fa; }
The title font size:
.toc-title { font-size: 24px; }
*Edit the mobile version padding or spacing using the @media
block at the bottom of the CSS.
Want more plugins? Check out my personal library!
📜 Expandable Table of Contents for Squarespace
Copy and paste this into a Code Block inside your Blog Post Template.