Avoid Missing Inputs: How to Build an EPUB File with a Table of Contents and Cover

One EPUB file assembled from a manuscript, contents, and cover

To build a one-chapter EPUB file with navigation and a cover, first place the inputs and the package’s internal references on one contract sheet. The inputs are the chapter source and cover.png. The package joins nav.xhtml, content.opf, cover.xhtml, chapter.xhtml, colophon.xhtml, container.xml, mimetype, and the archived cover.png. File presence is not enough: OPF IDs and hrefs, spine idrefs, the table-of-contents destination, and the cover-page image src must all resolve.

This article owns that one-chapter package contract. Running Rune Studio’s six-page EPUB wizard with three chapters is a separate hands-on exercise.

Freeze the two inputs first

Record these inputs before creating package files.

Input ID Authoritative path Facts to check
CHAPTER-01 source/chapter.md heading, body, encoding, chapter ID
COVER-01 source/cover.png accepted image, format, authoritative path

Put title, creator, language, identifier, and modified time on the same card. A filename is not book metadata. The chapter heading becomes the authority for the nav label and destination. Keep cover alternatives outside the accepted input set and identify one file as COVER-01.

Define the eight package resources

Use this fixed one-chapter, navigation, cover, and colophon specimen.

No. Path inside the EPUB Role
1 mimetype declares the EPUB media type
2 META-INF/container.xml locates the package document
3 OEBPS/content.opf holds metadata, resources, and reading order
4 OEBPS/nav.xhtml provides the EPUB navigation document
5 OEBPS/Text/cover.xhtml displays the cover image
6 OEBPS/Text/chapter.xhtml contains CHAPTER-01
7 OEBPS/Text/colophon.xhtml contains publication information
8 OEBPS/Images/cover.png contains COVER-01 in the archive

The two source inputs and eight packaged resources are separate inventories. The presence of source/cover.png does not prove that OEBPS/Images/cover.png was archived and referenced by both the OPF and cover page.

Build chapter, cover, and colophon XHTML

Convert chapter.md into well-formed OEBPS/Text/chapter.xhtml with the XML namespace, head, title, and body. Give the chapter heading id="c01". The nav destination will be Text/chapter.xhtml#c01.

In OEBPS/Text/cover.xhtml, use one image reference to ../Images/cover.png. Match path case exactly. Keep creator, publisher, and publication date in OEBPS/Text/colophon.xhtml, using the values accepted on the input card.

Make nav.xhtml an EPUB 3 table of contents

The nav.xhtml file does not become a valid EPUB navigation document merely because it contains links. Register exactly one navigation resource in the OPF manifest and give that item properties="nav". In nav.xhtml, declare the epub namespace and include exactly one nav epub:type="toc".

Use an ordered list for the table of contents and point its one chapter entry to Text/chapter.xhtml#c01. The navigation contract passes only when:

  1. exactly one OPF item has properties="nav";
  2. exactly one nav element has epub:type="toc";
  3. the toc href resolves to c01, and its label matches the chapter heading.

A visible link without all three conditions does not satisfy this contract.

Join cover, manifest, and spine in content.opf

Define title, identifier, language, creator, and modified time once in OPF metadata. Register the cover image with properties="cover-image". If the package also carries legacy cover metadata, point it to that same cover-image ID instead of introducing a second authority.

The manifest needs at least these five resources:

The spine references the readable units in the order cover-page, chapter, and colophon. Put the cover page—not the PNG itself—in the spine. Trace every itemref idref to a manifest ID and then to an existing href.

Build the entrance with container.xml and mimetype

Set the rootfile in META-INF/container.xml to OEBPS/content.opf. An OPF that exists at another path is still unreachable when container.xml points elsewhere.

Root-level mimetype must contain only application/epub+zip. Store it as the first ZIP entry without compression, then add META-INF and OEBPS. Renaming an ordinary ZIP to .epub does not establish this entrance condition.

Check four reference chains

After packaging, check these chains rather than relying on appearance:

  1. container.xml → OEBPS/content.opf;
  2. OPF manifest → nav, cover-image, cover-page, chapter, and colophon resources;
  3. OPF spine → cover-page → chapter → colophon;
  4. nav toc href → chapter.xhtml#c01, and cover.xhtml img src → Images/cover.png.

Also check mimetype content, first-entry position, and uncompressed storage. Classify a defect as entrance, registration, reading order, navigation destination, or cover reference. That separates a missing chapter conversion from a missing archived cover.

When a chain breaks, return to the contract sheet before adding files directly to the archive. A container path that misses the OPF is an entrance defect. An existing resource absent from the OPF is a registration defect. An itemref that cannot resolve to a manifest item is a reading-order defect. A cover page whose image path fails is a cover-reference defect. Correct the authoritative row and regenerate the package, then repeat all four chains from the beginning; testing only the repaired link can miss a new ID or href mismatch. Record the first failing source, the corrected value, and the final resolved destination. The run passes only when the root entrance reaches the OPF, every registered resource exists, each spine reference resolves, the table-of-contents link reaches c01, the cover page reaches the selected PNG, and mimetype still occupies the first uncompressed ZIP entry.

Keep Rune Studio evidence within its verified boundary

An actual image-free EPUB check confirmed mimetype, META-INF, OEBPS, XHTML, nav, NCX, OPF metadata, manifest, spine, and colophon, and the package check passed.

In a separate cover-enabled EPUB, OEBPS/Images/cover.png, the OPF manifest entry, and the cover.xhtml reference all existed inside the ZIP. The checking result nevertheless classified the existing image as missing. The supported statement is therefore “the cover file and references were confirmed.” A cover-enabled package pass remains pending. The evidence proves neither a missing cover file nor a completed pass.

Rune Studio EPUB confirmation screen listing title, writing direction, page order, output file name and publish date
The confirm page of the EPUB wizard. Metadata, writing direction, page order, output file name, publish date and cover state are listed before export. Structural inspection of the result is a separate step.

Preserve the contract before generating more chapters

Avoiding missing EPUB inputs means fixing the chapter source and cover.png, defining eight package resources, and joining properties="nav", the toc nav, OPF cover/manifest/spine, container, mimetype, and colophon.

Only after this one-chapter contract is traceable should the workflow move to Rune Studio’s six-page EPUB wizard and check the three navigation destinations in the generated book. The product scope is available on the Rune Studio product page.