Indexes in EPUBs must follow a prescribed pattern using a set of index types.
Each index in the work should be nested in an index
type section within its own backmatter
document.
<body epub:type="backmatter"> |
We have developed a workflow that makes achieving the markup outlined below much easier. See Indexes under Development Process for more information.
Index Groups
An index that has groupings of some kind (usually alphabetical) should be tagged accordingly. If there are no discernible groupings, the entire index should be wrapped in an index-group
section.
<section epub:type="index"> |
Index Terms
Index terms are tagged as <span>
with epub:type="index-term"
and nested in an unordered list (<ul>
), using an <li>
tag.
<ul> |
Page Numbers
Lists of page numbers associated with index terms must be tagged with <a>
and nested in a <span>
with epub:type="index-locator-list"
.
<span epub:type="index-term">Aaron</span>, |
Cross References
Each cross-referenced term is tagged with <a>
, with attributes epub:type="index-term"
and href="#xyz"
, where “xyz” is the id
given to the other term. The parent tag depends on whether the term is preferred or related.
<!-- Preferred references --> |
Preferred (See)
Typically identified with “See,” preferred cross references are usually listed in place of a page number list. In EPUB indexes, they are tagged with a <span>
with epub:type="index-xref-preferred"
.
Related (See Also)
Typically identified with “See also,” related cross references usually appear along with a list of page numbers. Similar to preferred cross references, they are tagged with a <span>
with epub:type="index-xref-related"
.
Sub-listed Index Terms
Sub-listed terms should be listed in another <ul>
nested in the main term’s <li>
.
<li id="(unique id)"> |
Putting It All Together
Follow the link to see the full snippet: Index.