Answers.Body: <p>You can certainly use standard <code>&lt;a&gt;</code> tags with matching <code>id</code>s to create hyperlinks within an epub file, yes. The structure of the text could look like:</p>
  
  <pre><code>&lt;p class="body"&gt;Here is a bunch of text with a footnote &lt;a epub:type="noteref" href="notes.xhtml#note1" class="reference" id="ref1"&gt;[1]&lt;/a&gt;&lt;/p&gt;
  </code></pre>
  
  <p>With a matching note in a notes.xhtml file:</p>
  
  <pre><code>&lt;aside epub:type="rearnote" class="note" id="note1"&gt;1: Here is the related endnote &lt;a href="ch1.xhtml#ref1"&gt;[link back]&lt;/a&gt;&lt;/aside&gt;
  </code></pre>
  
  <p>There are a few best practices to consider:</p>
  
  <ul>
  <li>Make sure to give a reciprocal link for endnotes--that is, once you can click on the number to go read the endnote, you'll need another link to bring you back to the text from the endnote</li>
  <li>In the index, it's very handy to have a series of links at the top for each alphabetic subsection, so that a reader can select "G" and go to the "G" section of the index. The "G" subheader can then be a link back to the top of the index.</li>
  <li>If you're using epub 3.0, you should definitely add <code>epub:type</code> semantic markup for indices and foot/end notes. The details of that can be found in the <a href="http://www.idpf.org/epub/vocab/structure/">Structural Semantics Vocabulary</a>. These semantics enable reading systems to associate behaviors with certain kinds of content. This is what iBooks uses to generate <a href="http://www.pigsgourdsandwikis.com/2012/05/creating-pop-up-footnotes-in-epub-3-and.html">popup footnotes</a>, and if you've properly marked up your content, you're giving it the chance to get additional features with no more effort as reading systems design more functionality for that markup.</li>
  </ul>
  
  <p>Indices can be pretty painful to create if the production files weren't tagged correctly at the time of creation; one quick-and-dirty method to consider in that case is to insert <code>&lt;span epub:type="pagebreak" id="page1" /&gt;</code> into the document at each page break, then have the index link to the print page. This isn't ideal, as a print page can span multiple screens (particularly on a cell phone!), but it can get you part way there if you're interested in cutting corners.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-03-31T16:46:05.903Z
Answers.LastActivityDate: 2014-03-31T16:46:05.903Z
Answers.UserDisplayName: Tom
Answers.Body: <p>Yes, you can use internal links in ePub files. Depending on which tool you use to generate your ePubs (I prefer Sigil), you can develop the individual internal files using HTML directly. So you can create a link with an <code>&lt;a href=""&gt;</code> tag just as you would in a webpage. This is often used in creating custom tables of contents, or links to footnotes.</p>
  
  <p>To your edit: raw manually-edited ePub files are exactly the same in structure and syntax as HTML files (I'm assuming you're generating an archive of .xhtml files), so you can definitely include links just as you would when writing a webpage. If you want to link within the same page, you'll need the <code>&lt;a name="foo"&gt;</code> marker for the target, and then <code>&lt;a href="#foo"&gt;</code> for the link. To link to a different page, just include the page name as the target for the href instead.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-03-31T15:44:29.320Z
Answers.LastActivityDate: 2014-03-31T15:51:25.083Z
Answers.LastEditDate: 2014-03-31T15:51:25.083Z
Answers.UserDisplayName: Roger
Body: <p>In a technical book, it is common to have a reference to material in another part of the book. Can I use something like an <code>&lt;a href=""&gt;</code> tag in the HTML to provide a direct link? How would I do this when creating an ePub from scratch using raw, manually edited HTML?</p>
  
  <p>I can see that this would also be useful for creating an index page.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-05-05T21:23:45.990Z
Comments.Text: If you want to create an index page, might I suggest e.g. DocBook or DITA for creating your book (then transforming to EPUB) instead of hand crafting it? Indexes are valuable but specialized, and a more structured approach might help.
Comments.UserDisplayName: johntait.org
Tags: <epub><creation><production>
Title: Can I have "clickable" links/references/index entries in an ePub?
UserDisplayName: Donald.McLean
ThreadText: # Can I have "clickable" links/references/index entries in an ePub?
  
  (Asked by: username_0 on 2014-03-31)
  
  In a technical book, it is common to have a reference to material in another part of the book. Can I use something like an `<a href="">` tag in the HTML to provide a direct link? How would I do this when creating an ePub from scratch using raw, manually edited HTML?
  
  I can see that this would also be useful for creating an index page.
  
  **Tags:** epub, creation, production
  
  > **Comments:**
  > **username_1**: If you want to create an index page, might I suggest e.g. DocBook or DITA for creating your book (then transforming to EPUB) instead of hand crafting it? Indexes are valuable but specialized, and a more structured approach might help.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2014-03-31. Score: 9
  
  You can certainly use standard `<a>` tags with matching `id`s to create hyperlinks within an epub file, yes. The structure of the text could look like:
  
  ```
  <p class="body">Here is a bunch of text with a footnote <a epub:type="noteref" href="notes.xhtml#note1" class="reference" id="ref1">[1]</a></p>
  
  ```
  
  With a matching note in a notes.xhtml file:
  
  ```
  <aside epub:type="rearnote" class="note" id="note1">1: Here is the related endnote <a href="ch1.xhtml#ref1">[link back]</a></aside>
  
  ```
  
  There are a few best practices to consider:
  
  * Make sure to give a reciprocal link for endnotes--that is, once you can click on the number to go read the endnote, you'll need another link to bring you back to the text from the endnote
  * In the index, it's very handy to have a series of links at the top for each alphabetic subsection, so that a reader can select "G" and go to the "G" section of the index. The "G" subheader can then be a link back to the top of the index.
  * If you're using epub 3.0, you should definitely add `epub:type` semantic markup for indices and foot/end notes. The details of that can be found in the [Structural Semantics Vocabulary](http://www.idpf.org/epub/vocab/structure/). These semantics enable reading systems to associate behaviors with certain kinds of content. This is what iBooks uses to generate [popup footnotes](http://www.pigsgourdsandwikis.com/2012/05/creating-pop-up-footnotes-in-epub-3-and.html), and if you've properly marked up your content, you're giving it the chance to get additional features with no more effort as reading systems design more functionality for that markup.
  
  Indices can be pretty painful to create if the production files weren't tagged correctly at the time of creation; one quick-and-dirty method to consider in that case is to insert `<span epub:type="pagebreak" id="page1" />` into the document at each page break, then have the index link to the print page. This isn't ideal, as a print page can span multiple screens (particularly on a cell phone!), but it can get you part way there if you're interested in cutting corners.
  
  
  ---
  
  ### Answer by username_3 on 2014-03-31. Score: 1
  
  Yes, you can use internal links in ePub files. Depending on which tool you use to generate your ePubs (I prefer Sigil), you can develop the individual internal files using HTML directly. So you can create a link with an `<a href="">` tag just as you would in a webpage. This is often used in creating custom tables of contents, or links to footnotes.
  
  To your edit: raw manually-edited ePub files are exactly the same in structure and syntax as HTML files (I'm assuming you're generating an archive of .xhtml files), so you can definitely include links just as you would when writing a webpage. If you want to link within the same page, you'll need the `<a name="foo">` marker for the target, and then `<a href="#foo">` for the link. To link to a different page, just include the page name as the target for the href instead.
  
  
  ---
  
  