Nests lists for TOC in epub

  • This topic has 2 replies, 2 voices, and was last updated 2 years, 1 month ago by MeredithThompson.
Viewing 3 posts - 1 through 3 (of 3 total)
Nests lists for TOC in epub thread
Author Posts
MeredithThompson

Hi all,

I’m hoping for some help with nested lists on the TOC of my epub? The HTML is fine as far as I can tell, or at least Sigil is not throwing out any error messages, but it keeps getting error messages from EPUB-Checker when I run it through.

I’m using

    tags for the whole list and then

      tags under each heading I want things to nest under, closing with

    before the new header.

    It doesn’t like

    tags or

      tags. It keeps saying: “Error while parsing file: element “ul” (but “ol” when I’ve tried that) not allowed here; expected the element end-tag or element “li”

      But if I just use “li” then the entire thing is bullets and it looses its nested attribute, unless there

       

      Help please! I feel like I’m doing something silly/simple wrong, but I can’t figure out what it is.

       

      Thank you!

       

      Best,
      Meredith Thompson (NeWest Press)

       

       

       

APLN Moderator

Hi Meredith,

Thank you for this topic! It might be helpful to share a screenshot so we have a better idea. A TOC usually has an ordered list since its in a specific sequence. Nested lists would start with a <li> tag for a Part, for example, which will then have a nested <ol> tag with the relevant items (chapters or headings) underneath, after which you would close the list with </ol> and the Part with </li>.  The list style would be ‘none’ in the CSS if you don’t want bullets.

An example of nested TOC lists would be:

<nav epub:type="toc" role="doc-toc" aria-labelledby="toc1">
<h1 id="toc1">Contents</h1>
<ol class="none1">
<li><a href="00_Cover_Page.xhtml">Cover</a></li>
<li><a href="01_Halftitle_Page.xhtml">Half Title</a></li>
<li><a href="02_Title_Page.xhtml">Title</a></li>
<li><a href="03_Copyright_Page.xhtml">Copyright</a></li>
<li><a href="04_Contents.xhtml">Contents</a></li>
<li><a href="05_Acknowledgements.xhtml">Acknowledgements</a></li>
<li><a href="06_1___Partone.xhtml">1 | Part 1</a>
<ol class="none1">
<li><a href="06_1___Partone.xhtml#sec1">Heading 1</a></li>
<li><a href="06_1___Partone.xhtml#sec2">Heading 2</a></li>
<li><a href="06_1___Partone.xhtml#sec3">Heading 3</a></li>
</ol>
</li>
<li><a href="07_2___Parttwo.xhtml">Part Two</a>
<ol class="none1">
<li><a href="07_2___Parttwo.xhtml#sec1">Heading 1</a></li>
<li><a href="07_2___Parttwo.xhtml#sec2">Heading 2</a></li>
</ol></li>
<li><a href="15_Index.xhtml">Index</a></li>
<li><a href="16_About_the_Author.xhtml">About the Author</a></li>
</ol>
</nav>

Let me know if this works!

MeredithThompson

Thanks so much! Yes, I was not nesting the entire sub-list inside the list tags. All fixed now! Thanks again!

 

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Want to join the discussion?

a wooden table with a white keyboard on top, and a persons hand writing on a piece of paper

View our current resources