Quote:
Originally Posted by bookman156
Code:
<p class="toc"><a href="../Text/Example.Article.xhtml">“Example Article” by Tex</a></p>
Apparently not allowed in nav.xhtml:
|
lol. Yeah. That's basic EPUB2 code I gave.
EPUB3 code is slightly different.
I wouldn't really manually mess too much with the nav.xhtml, because it requires proper nesting.
Again, it's pretty hard to see because you're working on a short/simple book, but the details become easier to see on more complicated documents (parts/chapters/subchapters).
* * *
Best Way to Generate Table of Contents?
In Sigil, you can use:
1.
Tools > Table of Contents > Generate Table of Contents.
This will update your:
- toc.ncx (EPUB2)
- nav.xhtml (EPUB3)
2.
Tools > Table of Contents > Create HTML Table of Contents.
This will create a:
- TOC.xhtml
- Especially helpful for EPUB2.
Where Do These Tools Get Their Information?
The Headings (<h1> -> <h6>) in your book:
Code:
<h1>Part 1</h1>
<h2>Chapter 1: The Beginning</h2>
<h3>The Calm Before the Storm</h3>
[...]
<h1>Part 2</h1>
This will create a TOC like this:
- Part 1
-- Chapter 1: The Beginning
--- The Calm Before the Storm
- Part 2
What If I Want the TOC to Display Something Different?
You can take advantage of
title:
Code:
<h2 title="1. The Beginning">Chapter 1: The Beginning</h2>
Now, when you generate your TOC, Sigil will put:
- Part 1
--
1. The Beginning
--- The Calm Before the Storm
The TOC text changes, while your actual text in your book looks the same!
What If My Book Doesn't Have Headings?
Then you can use:
- Tools > Table of Contents > Edit Table of Contents
You can manually rename entries + point them to specific files.
But, warning, these changes can easily be overwritten + will need to manually be done each time.
(Better to rely on the automatic tools as much as you can!)
How Do I Know My Changes Are Working?
Press:
- View > Table of Contents (Alt+F3)
This will show you the current ebook Table of Contents as Sigil sees it.
For EPUB2, this is what's in the toc.ncx file.
For EPUB3, this is what's in the nav.xhtml file.
- - - -
Note: There are many other "hidden" TOC tricks you can do in Sigil. For more information, see my posts from earlier this year:
and all the linked threads.
(All that info was for EPUB2, but it's all relevant for EPUB3 too.)
Quote:
Originally Posted by bookman156
However, I see that simply striping out the Landmarks code from nav.xhtml that epubcheck has no problem with that.
|
Don't do that. The
landmarks section is important for Accessibility.