- HubPages Tutorials and Community»
- Improving Your Article
Table of Contents
Creating a Table of Contents in your Hub
I'll probably write this and then the powers-that-be will create a Capsule to do in a few seconds what may take a while to create.Which is fine by me! I wish there was such a capsule!But in the meantime you can do it the way I've done it.
Why have a Table of Contents?
If you go to my hub on HubScore, and after what I call the Introduction Capsule, you'll notice that I have a capsule titled Table of Contents.I figured that I have a long hub, and there's information there that people might want to go back to as a quick reference. Rather have them scroll through the entire hub they can browse through the Table of Contents list, click, and jump straight to the bit that they need.To be quite honest I've put it there to make it easier for ME to find the information.
I used the Links Capsule to pull it off.
You could probably use the Text Capsule to do it too.
It's important to note that while you're in edit mode the Table of Contents won't work properly. It won't jump you down on the same browser window. It'll open a new browser window. So keep that in mind.
Open up your hub. In the view that the general public sees (ie: not in edit mode).Copy and paste your capsule titles into a Notepad text document (or whatever you feel like using) EXACTLY as they are. Make a list of the ones you want in your table of contents.
You now have to enter the alien world of HTML.
To do this you have to view the Page Source of your hub.
A reminder: make sure you're in the normal view of your hub, not in edit mode.
In Firefox you Right click and select View Page Source. In Internet Explorer you Right click and select View Source. It will open up a new page, like a Notepad text document.
Next you want to FIND each of the titles that you've copied and pasted. One at a time.
Now lets say you have a Capsule that you've titled "Café Royale", you want to search for that IN the source code.
The CTRL F keys should bring up the ability to do a search. Copy and paste Café Royale in and find it.
You'll find something like this:
<div id="mod_487697" class="module moduleImage"><h2>Café Royale2</h2>
If it's wrapped in the h2 tags, then that's more than likely our target! If it's not, then keep lookin (because you may have used the word more than once).
What you do next is "grab" the div id. In this illustration it is mod_487697.
Copy and paste that underneath the corresponding title in your Notepad doc. You'll be using it later.
Go through and find every div id for each of your titles. Copy and paste each one.
Now lets say your hub is http://hubpages.com/hub/Hubscore what you do next is add a # to the end of that and copy and paste http://hubpages.com/hub/Hubscore# to the start of each of your div id's that you have in your list.
So it would look like this: http://hubpages.com/hub/Hubscore#mod_487697
What you have now is a link that goes STRAIGHT to that module. Each of those "module ID's" are unique. Try it out with one of your own in the address field of your browser window.
BOOM. Straight there.
Now go into Edit Mode on your hub and add a Links Capsule. Move it to near the top. I position mine AFTER an introduction. I don't want people and particularly Search Engines to see it straight away. It being in second position seems like a good place to put it.
Now go through your Notepad list. Copy and paste each in Link URL/Link Title and Add Link. No need to add a Link Description. But that's up to you.
Keep doing that until it's all done.
Then of course save it.
And publish it.
And then try it.
How'd you go?
Hopefully it worked for you. It should. If it didn't then you've probably made an itty bitty mistake somewhere. HTML is unforgiving. You leave anything out or accidentally put anything in (even a space), and it won't work.
If you're unfamiliar with HTML it can be a bit daunting but if you've got a keen eye and a sense of adventure then keep at it and you'll get it right eventually.