1

I've created an epub that works great. It has daily meditations, for a total of 366. In my epub, the TOC is nested, so if I want to go to October 15, I click on October, the dates expand out 1 - 31, then I click on 15. When I converted it to Mobi, however, on my Kindle the TOC is like:

January
1    
2
3
4
.
.
.
February
1
2
3
4
.
.
.
and so on to Dec 31.  

How do I fix my menu to be nested like the epub?

So far everything else is looking fine on the mobi.

  • how are you creating your mobi file? How are you creating Nested menus in epub? – idiotprogrammer Oct 16 '18 at 15:28
  • Welcome to SE ebooks. Your question seems fine, but I have no answer. However I added two relevant tags, which may attract more users. – babou Oct 21 '18 at 0:33
1

The Amazon Publishing Guidelines has sample code for making a nested html TOC.

It's on page 16

<div>Section 1</div> 
<div style="margin-left:2%;">Chapter 1</div> 
<div style="margin-left:2%;">Chapter 2</div> 
<div style="margin-left:2%;">Chapter 3</div> 
<div style="margin-left:4%;">Subchapter 1</div> 
<div style="margin-left:4%;">Subchapter 2</div> 
<div style="margin-left:2%;">Chapter 4</div> 
<div style="margin-left:4%;">Subchapter 1</div> 
<div>Section 2</div> 
 ... 

Now here's an alternate way to do the same thing:

<style> div.chapter { margin-left: 1em} 
 div.subchapter { margin-left: 2em} </style> 
<div>Section 1</div> 
<div class="chapter">Chapter 1</div> 
<div class="chapter">Chapter 2</div> 
<div class="chapter">Chapter 3</div> 
<div class="subchapter">Subchapter 1</div> 
<div class="subchapter">Subchapter 2</div> 
<div class="chapter">Chapter 4</div> 
<div class="subchapter">Subchapter 1</div> 
<div>Section 2</div> ...

I've never tried it, but I assume it will work.

Also, I found another working example for nested TOC in the book EPUB3 Best Practices by Matt Garrish and Markus Gylling. The code they used depending on very sophisticated CSS for the NAV element. I'm guessing that this is only an EPUB solution and wouldn't work for the Kindle.

FURTHER THOUGHTS: It's not mentioned in the Amazon Publishing Guidelines, but I assume that all of this html is inside the <nav epub:type="toc"> element (leading me to wonder why the elements here are all DIVs instead of LIs).

  • Kindles have two TOCs: an (inline) HTML TOC and a logical TOC (NCX/NAV). Your example is for the HTML TOC. It can not be used inside the <nav epub:type="toc"> element, which is an epub3 only feature that requires a different syntax, which is outlined under 5.2.1 Creating a Logical TOC Using a toc nav Element. The OP's problem is caused by an incorrectly formatted NCX or NAV file. – Nemo XXX Oct 19 '18 at 7:10
  • NCX files are deprecated after epub3 ( idpf.org/epub/301/spec/epub-publications.html#ncx-superseded ) , and if my memory serves me correctly, Kindle doesn't pay attention to them anymore. The NAV element is very important because it provides both the logical TOC and the inline TOC. That said, I'm not sure that using margin-left accomplishes the goal of indenting subchapters in the logical TOC. – idiotprogrammer Oct 24 '18 at 2:14
  • The section on NCX might be out of date. That said, there is an easy way to verify way to verify that Kindle ignores the NCX/NAV. Hand edit one chapter title there so it's different from what's in the NAV file. (I'll report back to confirm) – idiotprogrammer Oct 24 '18 at 2:16
  • @idiotprogrammer: KindleGen will use the NAV TOC in epub3 books and the NCX TOC in epub2 books. If an epub3 book contains both NAV and NCX TOCs, the NCX TOC will be ignored. The OP's problem might also be caused by Calibre, if s/he selected the old Mobi7 format as the output format. – Nemo XXX Oct 25 '18 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.