• I’m creating a page that will be over 30 pages long. Is there a way to create a table of contents at the start of the page that will have automatic hyperlinking to the different sections?

Viewing 10 replies - 1 through 10 (of 10 total)
  • you could try:

    http://codex.wordpress.org/Template_Tags/previous_post
    http://codex.wordpress.org/Template_Tags/next_post
    http://codex.wordpress.org/Template_Tags/posts_nav_link

    eg. Default Usage

    By default, displays text "previous post:" as link along with post title.

    Does that help?

    Thread Starter blixel

    (@blixel)

    Hmm…. are you sure you are replying to my question and not someone elses? I’m asking about having a Table of Contents.

    For example, when you click on the page, the first thing you would see would be (something like) this.

    1. Introduction
    2. Hardware Overview
    3. Basic Installation
    4. Advanced Installation
    5. Closing Comments

    Pages: 1 2 3 4 5

    Lorelle mentioned a plugin recently that might get near to what you want. See the codex at
    http://weblogtoolscollection.com/pluginwiki/index.php?title=In-Series

    Yes, my In-Series plugin will do this exactly, but it works on a series of posts, and not one uber-long post.

    If you’re hoping to use a single post, my plugin won’t work. If you can break your post up into seperate unique posts, it should work just fine.

    I saw a plugin somewhere to create TOC based on headers in post. Have you looked in the two plugin databases?

    Okay, being the verbose one in the group, here is my EXPERIENCED answer. Make yourself a list.

    If you want to have jump point links within your document but you are unwilling to break it up into pages or posts, (Skippy’s plugin is AWESOME for that and you can see it in use on one of our online books) then you have to do the HTML. It ain’t fun, but it does the job.

    Here is a simple example.

    <div class="toclist">
    <ul>
    <li><a title="section one" href="#section1">Section One</a></li>
    <li><a title="section two" href="#section2">Section Two</a></li>
    <li><a title="section three" href="#section3">Section Three</a></li>
    </ul>
    </div>

    Fill it in with all of your references. Now, to make the link point in your document (called the “target”) you can do one of the two following:

    Simple: Works on most newer browsers but not all old.

    <h3 id="section1">Section One</h3>

    Old but Works: This works always but it can turn whatever you have highlighted into a link that links to itself, so you have two ways of using this. The second one doesn’t always validate, but it works – just know that.

    <h3><a name="section1">Section One</a></h3>

    <a name="section1"></a><h3>Section One</h3>

    Now, in your style sheet, create a style called “toclist” or whatever you want and give it some “style” like this simple box:

    .toclist {border: solid 1px blue; margin:5px; padding: 5px; text-align: left; font-size: 90%}
    .toclist ul {}
    .toclist li {}

    In the ul and li, you may have to experiment, depending upon how your Theme’s style sheet styles your lists and you might even have to resort to negative margins on the left to make sure the bullets (if you use them) will fit within the box. From here, it’s experimentation, but you got the basics.

    I REALLY REALLY recommend that you break it up into sections and use something like Skippy’s In-Series plugin. Long posts are painful to load and people lose interest before they even get to the third paragraph, as most people have just reading this instruction. 😉

    Another note. If you choose to break it up using WordPress’ NEXTPAGE tag, and make a TOC with links to targets within that single but divided post, you have to make the links feature the page number, which gets really complicated.

    I should have given you a list to an example on my site where I use “forced” handmade TOCs. Sorry.

    They are a pain, but they do serve a purpose.

    To make a plugin that will do this is challenging. It would have to hunt for every title heading (are you using h2, h3, h4?) or all of them in your post (what will it do with the subheads? Nested lists?), add an anchor name to each one, and then return them in a container with all the jump links and information all spelled out. It’s quite a task.

    Thread Starter blixel

    (@blixel)

    This is the documentation I want to convert.

    http://www.davidcourtney.org/soekris.html

    As you can see, it’s relatively lengthy. At least compared to a typical web article that is 2 or 3 pages.

    I don’t think I care if I create 1 page, or 40 pages as long as it works. Actually, 40 separate pages would probably be a lot easier to maintain than 1 uber page. But I need it to appear as 1 logical document when I’m done.

    http://www.davidcourtney.org/wordpress/?page_id=5

    Here is what I have converted over so far. It’s incomplete and some of the links are broken. Right now I’m just trying to figure out the best way to bring it all together so that I can minimize the amount of rework. This document is also ongoing so I would like to have as much automation as possible with it. i.e. Auto table of contents with links to the relevant sections. If I need to insert a page in the middle, or remove a page somewhere, I don’t want to have to manually edit all the links to all the pages.

    Thread Starter blixel

    (@blixel)

    I just read over all the replies a second time. I like the idea of creating a new page for each page (like in my original document). That would be about 30 or 40 pages total.

    Originally that was what I set out to do. But I *thought* I found out that you had to use the <!–nextpage–> thing to break up the pages. So I started over.

    I’d like to go back and start again and create a new WP page for each page of my document. But – after readining these posts – I’m still confused as to how I tie them together.

    Maybe WP is over my head.

    The page feature is half-hearted (frankly I was considering using a stronger word) IMHO.

    Even with full feed option, the other pages are not displayed!

    Would someone care enough to come out and explain the inner workings of the Page feature?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Automatic Table of Contents?’ is closed to new replies.