View Single Post
Old 12-08-2020, 03:34 PM   #7
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,731
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Banjo View Post
OK. I must be missing something. The links in the index are calculated by Sigil when I create the index. How do I put a link in the index myself?
If you want Sigil to create the links, you'll have to insert two anchors with class="sigil_index_marker" attributes and the same text. Obviously, you'll need to hide one of the entries. (In the following example, I used inline styles for demonstration purposes; you'll want to use classes instead.)

To see how it works, create a blank epub2 book, replace the <body> section of Section0001.xhtml with the following code and generate the index.


Spoiler:
Code:
<body>
  <h1><a class="sigil_index_marker" style="display: none;" title="Other name for chapter 1">Chapter 1</a><a class="sigil_index_marker" title="Chapter 1">Chapter 1</a></h1>

  <p>Lorem ipsum...</p>

  <h1><a class="sigil_index_marker" style="display: none;" title="Other name for chapter 2">Chapter 2</a><a class="sigil_index_marker" title="Chapter 2">Chapter 2</a></h1>
</body>


This should generate an index with 4 entries two of which are actually linking to the same targets.
Doitsu is offline   Reply With Quote