View Single Post
Old 04-18-2021, 04:13 AM   #7
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by shore_pk View Post
Is it possible to have this Sigil point to the same page more than one time in the table of contents?
Yes, but like KevinH said, there may be a few warnings going off with the EPUB checking tools!

TOCs are very important for ebooks, as it lets the EPUB reader know which order chapters go in + how many "pages" are left while reading.

And 99.9% of the time, duplicates are accidents.

(I'll explain further below.)

Quote:
Originally Posted by shore_pk View Post
Table of Contents

ABC Listing:
A
B
C

Listing by topic:
C
A
B

So in other words if I put xhtml pages A, B and C under heading ABC Listing. Can I then put them under Listing by topic but in a different order?
What is the goal here?

Are you creating a list of recipes by category+main-ingredient? A list of poems by year+author?

Perhaps there'll be an alternate way to organize or some other solution.

Quote:
Originally Posted by KevinH View Post
The trick is to add an anchor with an additional id but no txt right before your desired anchor. Now you can havetwo different destination ids that effectively go to the same location.
And this is the way you would do that:

Before:

Chapter01.xhtml:

Code:
<body>
<h2>Chapter 1</h2>
<p>There once was a time before time [...].</p>
TOC.xhtml:

Code:
<h2>Table of Contents</h2>
<p class="toc"><a href="../Text/Chapter01.xhtml">Chapter 1</a></p>
<p class="toc"><a href="../Text/Chapter02.xhtml">Chapter 2</a></p>
<p class="toc"><a href="../Text/Chapter03.xhtml">Chapter 3</a></p>
[...]
<h2>Alternate Table of Contents</h2>
<p class="toc"><a href="../Text/Chapter03.xhtml">Chapter 3</a></p>  <--- Duplicate Warning
<p class="toc"><a href="../Text/Chapter02.xhtml">Chapter 2</a></p>  <--- Duplicate Warning
<p class="toc"><a href="../Text/Chapter01.xhtml">Chapter 1</a></p>  <--- Duplicate Warning
After:

You'd want to add an "id" in your anchor, like KevinH suggested:

Chapter01.xhtml:

Code:
<body>
<h2 id="Chapter01">Chapter 1</h2>
<p>There once was a time before [...].</p>
Do you see that part in red? That's an id.

It doesn't do anything by itself, but...

You can tell a link to jump to that exact location by using a special symbol: #:

TOC.xhtml:

Code:
<h2>Table of Contents</h2>
<p class="toc"><a href="../Text/Chapter01.xhtml">Chapter 1</a></p>
<p class="toc"><a href="../Text/Chapter02.xhtml">Chapter 2</a></p>
<p class="toc"><a href="../Text/Chapter03.xhtml">Chapter 3</a></p>
[...]
<h2>Alternate Table of Contents</h2>
<p class="toc"><a href="../Text/Chapter03.xhtml">Chapter 3</a></p>  <--- Duplicate Warning
<p class="toc"><a href="../Text/Chapter02.xhtml">Chapter 2</a></p>  <--- Duplicate Warning
<p class="toc"><a href="../Text/Chapter01.xhtml#Chapter01">Chapter 1</a></p>
So let's break down that 1st link:

Code:
<a href="../Text/Chapter01.xhtml">
This is saying:
  • "Jump to a file called Chapter01.xhtml".

And the 2nd link:

Code:
<a href="../Text/Chapter01.xhtml#Chapter01">
is saying two things:
  • "Jump to a file called Chapter01.xhtml"
  • "and jump to the location of the id called Chapter01" (red part)

That id just so happens to exist at the tippy top of the file as well, so they act nearly the same when the reader clicks on them.

Anyway, this would get rid of your little warnings... but as I said above, there may be a much better solution out there.

Last edited by Tex2002ans; 04-18-2021 at 04:23 AM.
Tex2002ans is offline   Reply With Quote