Extensions

Overview

The OPF file that represents the XHTML rendition of your EPUB (book.opf) is automatically generated.

Avoid direct edits to book.opf. Editing book.opf will lock book.opf and exclude it from the EPUB Generation process. Any subsequent changes to your Book’s structure or settings will not be reflected in book.opf. If you unlock book.opf, all your customizations will be lost.

Extensions allow you to include custom code in book.opf that is independent of the EPUB Generation process. Benefits include:

  • Your customizations do not disrupt the automatic EPUB Generation process
  • Your customizations will be included whenever the EPUB is regenerated
  • Your customizations will be validated by the EPUB Error Scanner

Working with Extensions

Extensions are found under the Templates section of the Code Editor.

The following Extensions are available:

ExtensionUsage
Package.tag.extensionThe contents of this file are inserted after the <spine> child element of <package>
Metadata.tag.extensionThe contents of this file are inserted after the last child element of <metadata>
Manifest.tag.extensionThe contents of this file are inserted after the last child element of <manifest>
Spine.tag.extensionThe contents of this file are inserted after the last child element of <spine>

Extensions should only include content that is allowed for Package Documents under the EPUB Specifications.


Related Concepts