Publishing Notes


Contents


EPUB

Template Files

Download EPUB Template

The personalization contents should all be marked with "UPDATE_" prefixes. Replace the cover.jpg and glyph.png files in the content/Images folder with your own. The instructions for converting the files into an EPUB are below.

I'm providing this as-is with no guarantees of functionality. Feel free to share this, and if you publish anything let me know! If you have any questions, slide into my DMs on Twitter.

File Structure

  1. mimetype: no extension, sits in root folder, only content is "application/epub+zip". Must be first file found in archive.
  2. META-INF: folder in root directory, mandatory.
  3. container.xml: sits in META-INF directory. Contains relative location of .opf file (package document).
    <?xml version="1.0" encoding="UTF-8"?>
    <container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0">
    <rootfiles>
    <rootfile full-path="content/package.opf" media-type="application/oebps-package+xml"/>
    </rootfiles>
    </container>
  4. content folder in root directory, contains all ebook contents and package manifests.
  5. package.opf: sits in content directory. Contains metadata, manifest, and default reading order of ebook ("spine"). Work in .xml then save as .opf
    <?xml version="1.0" encoding="UTF-8"?>
    <package xmlns="http://www.idpf.org/2007/opf" xmlns:opf="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="BookID">
    <metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
    <dc:identifier id="BookID" opf:scheme="isbn">UPDATE_ISBN</dc:identifier>
    <dc:title>UPDATE_TITLE</dc:title>
    <dc:description>UPDATE_DESCRIPTION</dc:description>
    <dc:language>en-US</dc:language>
    <dc:publisher>UPDATE_PUBLISHER</dc:publisher>
    <dc:creator>UPDATE_AUTHORNAME</dc:creator>
    <dc:rights>© UPDATE_COPYRIGHT_HOLDER</dc:rights>
    <meta property="dcterms:modified">2020-01-01T01:01:01Z</meta>
    <!-- OPTIONAL
    <dc:contributor>UPDATE_CONTRIBUTOR</dc:contributor>
    <dc:subject>UPDATE_SUBJECT</dc:subject>
    <dc:subject>UPDATE_SUBJECT2</dc:subject> -->
    </metadata>
    <manifest>
    <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
    <item id="cover.jpg" href="Images/cover.jpg" media-type="image/jpeg" properties="cover-image"/>
    <item id="cover.xhtml" href="Text/cover.xhtml" media-type="application/xhtml+xml"/>
    <item id="toc" href="toc.html" media-type="application/xhtml+xml" properties="nav"/>
    <item id="chapter-1.xhtml" href="Text/chapter-1.xhtml" media-type="application/xhtml+xml"/>
    <item id="publication.css" href="Styles/publication.css" media-type="text/css"/>
    <item id="UPDATE_OPENTYPEFONT.otf" href="Fonts/UPDATE_OPENTYPEFONT.otf" media-type="application/vnd.ms-opentype"/>
    <item id="glyph.png" href="Images/glyph.png" media-type="image/png"/>
    </manifest>
    <spine toc="ncx">
    <itemref idref="cover.xhtml"/>
    <itemref idref="toc"/>
    <itemref idref="chapter-1.xhtml"/>
    </spine>
    <guide>
    <reference title="Cover page" type="cover" href="Text/cover.xhtml"/>
    <reference title="Table of content" type="toc" href="toc.html"/>
    </guide>
    </package>
  6. toc.ncx: sits in content directory. Table of Contents file, at minimum the uid (unique identifier) must match the one in package.opf. I use the ISBN for simplicity. Work in .xml then save as .ncx
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
    <head>
    <!-- update the uid to match the uid ISBN in package.opf -->
    <meta name="dtb:uid" content="UPDATE_ISBN"/>
    <!-- update depth to reflect highest degree of navPoint nesting -->
    <meta name="dtb:depth" content="1"/>
    <!-- update generator to match current version of publishing software -->
    <meta name="dtb:generator" content="Adobe Dreamweaver 21.0 Build 15392"/>
    <!-- these can remain 0 -->
    <meta name="dtb:totalPageCount" content="0"/>
    <meta name="dtb:maxPageNumber" content="0"/>
    </head>
    <!-- this is the table of contents
    The "chapter" format is as follows:
    <navPoint id="simpleName" playOrder="#"><navLabel><text>Name</text></navLabel><content src="FILE"/></navPoint>
    Example:
    <navPoint id="cover" playOrder="1"><navLabel><text>Cover</text></navLabel><content src="Text/cover.xhtml"/></navPoint>
    -->
    <docTitle>
    <text>BOOK_TITLE</text>
    </docTitle>
    <navMap>
    <navPoint id="cover" playOrder="1"><navLabel><text>Cover</text></navLabel><content src="Text/cover.xhtml"/></navPoint>
    <navPoint id="titlepage" playOrder="2"><navLabel><text>Title Page</text></navLabel><content src="Text/title_page.xhtml"/></navPoint>
    <navPoint id="alsoby" playOrder="3"><navLabel><text>Also By</text></navLabel><content src="Text/also_by.xhtml"/></navPoint>
    <navPoint id="copyright" playOrder="4"><navLabel><text>Copyright</text></navLabel><content src="Text/copyright.xhtml"/></navPoint>
    <navPoint id="dedication" playOrder="5"><navLabel><text>Dedication</text></navLabel><content src="Text/dedication.xhtml"/></navPoint>
    <navPoint id="foreword" playOrder="6"><navLabel><text>Foreword</text></navLabel><content src="Text/foreword.xhtml"/></navPoint>
    <navPoint id="toc" playOrder="7"><navLabel><text>Table of Contents</text></navLabel><content src="Text/toc.xhtml"/></navPoint>
    <navPoint id="chapter-1" playOrder="8"><navLabel><text>Chapter 1</text></navLabel><content src="Text/chapter-1.xhtml"/></navPoint>
    <!-- UNCOMMENT AND DUPLICATE AS REQUIRED
    <navPoint id="chapterN" playOrder="N"><navLabel><text>Name</text></navLabel><content src="FILE"/></navPoint>
    !!UPDATE PLAYORDER BELOW!! -->
    <navPoint id="afterword" playOrder="9"><navLabel><text>Afterword</text></navLabel><content src="Text/afterword.xhtml"/></navPoint>
    <navPoint id="about" playOrder="10"><navLabel><text>About the Author</text></navLabel><content src="Text/about.xhtml"/></navPoint>
    </navMap>
    </ncx>
  7. content/Images folder for cover image, glyphs, etc.
  8. content/Text folder for chapters, foreword, afterword, etc.
  9. content/Styles folder for css stylesheets.
  10. content/Fonts for OTF files.

Cover Image

Stylesheet

Here's an example of a minimal stylesheet. No fonts required, no indent on leading paragraph, tab indent on every following paragraph, and spacing is all done inline during editing:

h1.title {
  margin-top: 4em;
  text-align: center;
  text-indent: 0em;
}
h3.subtitle {
  margin-top: 1em;
  text-align: center;
  text-indent: 0em;
}
h2.author {
  margin-top: 2em;
  text-align: center;
  text-indent: 0em;
}
p {
  margin: 0em;
  text-indent: 2em;
}
p.first {
  margin-top: 1em;
  text-indent: 0em;
}
p.centered {
  text-indent: 0em;
  text-align: center;
}
p.copyright {
  margin-top: 1em;
  text-align: center;
  text-indent: 0em;
}

Convert to EPUB

  1. Create a .zip archive from the mimetype file with no compression (Compression method → Normal)
    • Archive name → 1.zip
    • Archive format → ZIP
    • Compression method → Store
  2. Drag the content and META-INF folders into the new 1.zip archive.
  3. Rename archive from .zip to .epub
  4. Validate the file.

Home