Tech

WordPress jQuery Table of Contents plugin

I’m proud to announce my first WordPress plugin, “jQuery Table of Contents,” which inserts the lovely little table of contents you see on many of the pages of my website. It uses jQuery to inspect the content of your post or page and generate table of contents links based on the header tags. It’s easy, SEO friendly, and highly customizable.

Download


Download from WordPress Extend

Is this plugin helping you make money? Buy me a cup of coffee!





Installation

  1. Upload `jquery-toc.php`, `jquery-toc.css`, and `jquery-toc.js` to the `/wp-content/plugins/jquery-toc/` directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Important! – Configure the Table of Contents to customize it for your theme.

Demo

You’re looking at it. This site has a working example of the plugin. Look at the pink box in the top-right corner of this post.

Frequently Asked Questions

Q: Does this plugin work automatically for every theme?

A: Nope. The default settings provided will work out the box for the WordPress Default (Kubric) theme. Beyond that, you may have to change settings to get it to work with your theme.

Changelog

  • 1.0 – First public release

35 thoughts on “WordPress jQuery Table of Contents plugin

    1. Artem – Thanks for your question. I can think of a number of advantages. Besides saving server time, my plugin:

      Doesn’t insert the TOC into the html of the document, which makes for cleaner markup.
      Simpler to configure to get a usable TOC out of the box.
      Inserts automatic links back to the top of the document.

      It also has some technical merits that I think are worth considering:

      Doesn’t try to parse HTML with PHP. Web browsers and Javascript are designed to handle manipulating the DOM already, so I think it’s a superior tool.
      Much simpler PHP plugin code means that there is less to break in future PHP and WordPress upgrades.

      SEO Table of Contents isn’t a bad plugin at all, and if it meets your needs, please use it. But if all you want is a simple table of contents that you don’t have to think much about, my plugin fits that niche pretty nicely.

    1. Artem – Thanks for your question. I can think of a number of advantages. Besides saving server time, my plugin:

      1. Doesn’t insert the TOC into the html of the document, which makes for cleaner markup.
      2. Simpler to configure to get a usable TOC out of the box.
      3. Inserts automatic links back to the top of the document.

      It also has some technical merits that I think are worth considering:

      1. Doesn’t try to parse HTML with PHP. Web browsers and Javascript are designed to handle manipulating the DOM already, so I think it’s a superior tool.
      2. Much simpler PHP plugin code means that there is less to break in future PHP and WordPress upgrades.

      SEO Table of Contents isn’t a bad plugin at all, and if it meets your needs, please use it. But if all you want is a simple table of contents that you don’t have to think much about, my plugin fits that niche pretty nicely.

  1. Excellent! Could you pllease let me know when that happens and post a link? I have subscribed to these comments…

  2. Excellent! Could you pllease let me know when that happens and post a link? I have subscribed to these comments…

  3. I wonder if SEO Table of Contents does anything for SEO or is just another marketing device as if it did do something for SEO.

    What I am having a problem with is the placement of the TOC box (mine shows up above the title for some reason and breaks up the post without wrap) and it doesn't appear in most of my posts – only some, not others. Can't figure out why that is.

  4. I think SEO Table of Contents does do things well – it adds “bookmark nofollow” to the links, so you don't get a penalty for spaminess, it's list-based, and it adds good title attributes to its links. It certainly won't hurt your SEO.

    Is the trouble you're having with SEO Table of Contents or with jQuery TOC? Perhaps you can post a link to where the graphical issues are happening, or a link to a screenshot? An email to me would be fine, too.

Comments are closed.