Naming Conventions for ePUB Files

  • Sumo

Two recent recent  posts have highlighted the need to pay attention to how you name your files in an ePUB. The first is Cari Jansen’s “Tomaxxi’s Script: Renaming images from within InDesign” in which she shows how she used a script from Marijan Tompa/Tomaxxi to convert the names of image files that had “all sorts of naming conventions. Including the use of special characters.” (If you work in InDesign and haven’t looked at the downloads available at Marijan Tompa’s site, including the script tomaxxiLINKrename used by Cari Jansen to rename a placed link, you really should take a peek.)

The second post was Liz Castro’s “Non-allowed characters in filenames in EPUB” in which she looked at how even the inclusion of a space in a file name (“Title Page.html”) can cause problems when creating ePUBs of InDesign because ID does not automatically convert a space in a name to the URL friendly %20. While Liz suggests using only number and letters and hypens (-) and underlines (_), there have also been reports of hyphens in file names causing issues in iBooks. (For a list of what generally works and doesn’t work in a URL, you can view this page on URL Encoding.)

These posts made me think about file naming conventions. Whether you are using InDesign to convert books to ePUB or creating ePUBs from Word or HTML, you should consider adopting some consistent naming conventions for files. Not only will this make it easy for you to know what each file is it will also allow you easily adapt any scripts, find/replace, GREP, or RegEx you regularly use to any book you are working on.

Do you have naming conventions you use for your ePUB files? What are they? Why do you name files the way you do?

I usually name files using the ISBN, and underscore, then a three to five character name that identifies what the file is. I like to use the text after the underscore as IDs where needed, so I always begin them with letters (which you must do for any ID used in an ePUB). So the files would look something like this in the OPF file:


<item id="ncx" href="978XXXXXXX_ncx.ncx" media-type="application/x-dtbncx+xml"/>
<item id="cov" href="978XXXXXXX_cov.htm" media-type="application/xhtml+xml"/>
<item id="tp" href="978XXXXXXX_tp.htm" media-type="application/xhtml+xml"/>
<item id="cop" href="978XXXXXXX_cop.htm" media-type="application/xhtml+xml"/>
<item id="toc" href="978XXXXXXX_toc.htm" media-type="application/xhtml+xml"/>
<item id="prf" href="978XXXXXXX_prf.htm" media-type="application/xhtml+xml"/>
<item id="p01" href="978XXXXXXX_p01.htm" media-type="application/xhtml+xml"/>
<item id="c01" href="978XXXXXXX_c01.htm" media-type="application/xhtml+xml"/>
<item id="c02" href="978XXXXXXX_c02.htm" media-type="application/xhtml+xml"/>
<item id="c03" href="978XXXXXXX_c03.htm" media-type="application/xhtml+xml"/>
<item id="c04" href="978XXXXXXX_c04.htm" media-type="application/xhtml+xml"/>
<item id="c05" href="978XXXXXXX_c05.htm" media-type="application/xhtml+xml"/>
<item id="c06" href="978XXXXXXX_c06.htm" media-type="application/xhtml+xml"/>
<item id="c07" href="978XXXXXXX_c07.htm" media-type="application/xhtml+xml"/>
<item id="c08" href="978XXXXXXX_c08.htm" media-type="application/xhtml+xml"/>
<item id="c09" href="978XXXXXXX_c09.htm" media-type="application/xhtml+xml"/>
<item id="c10" href="978XXXXXXX_c10.htm" media-type="application/xhtml+xml"/>
<item id="c11" href="978XXXXXXX_c11.htm" media-type="application/xhtml+xml"/>
<item id="c12" href="978XXXXXXX_c12.htm" media-type="application/xhtml+xml"/>
<item id="c13" href="978XXXXXXX_c13.htm" media-type="application/xhtml+xml"/>
<item id="c14" href="978XXXXXXX_c14.htm" media-type="application/xhtml+xml"/>
<item id="c15" href="978XXXXXXX_c15.htm" media-type="application/xhtml+xml"/>
<item id="c16" href="978XXXXXXX_c16.htm" media-type="application/xhtml+xml"/>
<item id="c17" href="978XXXXXXX_c17.htm" media-type="application/xhtml+xml"/>
<item id="c18" href="978XXXXXXX_c18.htm" media-type="application/xhtml+xml"/>
<item id="c19" href="978XXXXXXX_c19.htm" media-type="application/xhtml+xml"/>
<item id="c20" href="978XXXXXXX_c20.htm" media-type="application/xhtml+xml"/>
<item id="c21" href="978XXXXXXX_c21.htm" media-type="application/xhtml+xml"/>
<item id="c22" href="978XXXXXXX_c22.htm" media-type="application/xhtml+xml"/>
<item id="c23" href="978XXXXXXX_c23.htm" media-type="application/xhtml+xml"/>
<item id="c24" href="978XXXXXXX_c24.htm" media-type="application/xhtml+xml"/>
<item id="c25" href="978XXXXXXX_c25.htm" media-type="application/xhtml+xml"/>
<item id="p02" href="978XXXXXXX_p02.htm" media-type="application/xhtml+xml"/>
<item id="c26" href="978XXXXXXX_c26.htm" media-type="application/xhtml+xml"/>
<item id="c27" href="978XXXXXXX_c27.htm" media-type="application/xhtml+xml"/>
<item id="c28" href="978XXXXXXX_c28.htm" media-type="application/xhtml+xml"/>
<item id="c29" href="978XXXXXXX_c29.htm" media-type="application/xhtml+xml"/>
<item id="c30" href=978XXXXXXX_c30.htm" media-type="application/xhtml+xml"/>
<item id="c31" href="978XXXXXXX_c31.htm" media-type="application/xhtml+xml"/>
<item id="c32" href="978XXXXXXX_c32.htm" media-type="application/xhtml+xml"/>
<item id="c33" href="978XXXXXXX_c33.htm" media-type="application/xhtml+xml"/>
<item id="c34" href="978XXXXXXX_c34.htm" media-type="application/xhtml+xml"/>
<item id="c35" href="978XXXXXXX_c35.htm" media-type="application/xhtml+xml"/>
<item id="c36" href="978XXXXXXX_c36.htm" media-type="application/xhtml+xml"/>
<item id="c37" href="978XXXXXXX_c37.htm" media-type="application/xhtml+xml"/>
<item id="c38" href="978XXXXXXX_c38.htm" media-type="application/xhtml+xml"/>
<item id="c39" href="978XXXXXXX_c39.htm" media-type="application/xhtml+xml"/>
<item id="c40" href="978XXXXXXX_c40.htm" media-type="application/xhtml+xml"/>
<item id="p03" href="978XXXXXXX_p03.htm" media-type="application/xhtml+xml"/>
<item id="c41" href="978XXXXXXX_c41.htm" media-type="application/xhtml+xml"/>
<item id="c42" href="978XXXXXXX_c42.htm" media-type="application/xhtml+xml"/>
<item id="c43" href="978XXXXXXX_c43.htm" media-type="application/xhtml+xml"/>
<item id="c44" href="978XXXXXXX_c44.htm" media-type="application/xhtml+xml"/>
<item id="c45" href="978XXXXXXX_c45.htm" media-type="application/xhtml+xml"/>
<item id="c46" href="978XXXXXXX_c46.htm" media-type="application/xhtml+xml"/>
<item id="c47" href="978XXXXXXX_c47.htm" media-type="application/xhtml+xml"/>
<item id="c48" href="978XXXXXXX_c48.htm" media-type="application/xhtml+xml"/>
<item id="c49" href="978XXXXXXX_c49.htm" media-type="application/xhtml+xml"/>
<item id="c50" href="978XXXXXXX_c50.htm" media-type="application/xhtml+xml"/>
<item id="bm" href="978XXXXXXX_bm.htm" media-type="application/xhtml+xml"/>
<item id="ata" href="978XXXXXXX_ata.htm" media-type="application/xhtml+xml"/>
<item id="ded" href="978XXXXXXX_ded.htm" media-type="application/xhtml+xml"/>
<item id="obb" href="978XXXXXXX_obb.htm" media-type="application/xhtml+xml"/>
<item id="css" href="978XXXXXXX_css.css" media-type="text/css"/>
<item id="my_cover_image" href="images/cover.jpg" media-type="image/jpeg"/>
<item id="tpi01" href="images/tpi01.jpg" media-type="image/jpeg"/>
<item id="copi01" href="images/copi01.jpg" media-type="image/jpeg"/>
<item id="dingbat1" href="images/dingbat1.jpg" media-type="image/jpeg"/>
<item id="dingbat2" href="images/dingbat2.jpg" media-type="image/jpeg"/>
<item id="c23i01" href="images/c23i01.jpg" media-type="image/jpeg"/>
<item id="c24i01" href="images/c24i01.jpg" media-type="image/jpeg"/>
<item id="c25i01" href="images/c25i01.jpg" media-type="image/jpeg"/>
<item id="c26i01" href="images/c26i01.jpg" media-type="image/jpeg"/>
<item id="c27i01" href="images/c27i01.jpg" media-type="image/jpeg"/>
<item id="c28i01" href="images/c28i01.jpg" media-type="image/jpeg"/>
<item id="c29i01" href="images/c29i01.jpg" media-type="image/jpeg"/>
<item id="c30i01" href="images/c30i01.jpg" media-type="image/jpeg"/>
<item id=c31i01" href="images/c31i01.jpg" media-type="image/jpeg"/>
<item id="c32i01" href="images/c32i01.jpg" media-type="image/jpeg"/>
<item id="c33i01" href="images/c33i01.jpg" media-type="image/jpeg"/>
<item id="c34i01" href="images/c34i01.jpg" media-type="image/jpeg"/>
<item id="c35i01" href="images/c35i01.jpg" media-type="image/jpeg"/>
<item id="c36i01" href="images/c36i01.jpg" media-type="image/jpeg"/>
<item id="c37i01" href="images/c37i01.jpg" media-type="image/jpeg"/>
<item id="c38i01" href="images/c38i01.jpg" media-type="image/jpeg"/>
<item id="c39i01" href="images/c39i01.jpg" media-type="image/jpeg"/>
<item id="c40i01" href="images/c40i01.jpg" media-type="image/jpeg"/>
<item id="c41i01" href=images/c41i01.jpg" media-type="image/jpeg"/>
<item id="c42i01" href="images/c42i01.jpg" media-type="image/jpeg"/>
<item id="c43i01" href="images/c43i01.jpg" media-type="image/jpeg"/>
<item id="c44i01" href="images/c44i01.jpg" media-type="image/jpeg"/>
<item id="c45i01" href="images/c45i01.jpg" media-type="image/jpeg"/>
<item id="c46i01" href="images/c46i01.jpg" media-type="image/jpeg"/>
<item id="c47i01" href="images/c47i01.jpg" media-type="image/jpeg"/>
<item id="c48i01" href="images/c48i01.jpg" media-type="image/jpeg"/>
<item id="c49i01" href="images/c49i01.jpg" media-type="image/jpeg"/>
<item id="c50i01" href="images/c50i01.jpg" media-type="image/jpeg"/>
<item id="page" href="page-template.xpgt" media-type="application/vnd.adobe-page-template+xml"/>

  • cov=cover
  • tp=title page
  • cop=copyright page
  • toc=table of contents
  • prf=preface
  • p01=part one
  • c01=chapter one
  • bm=back matter
  • ata=about the author
  • ded=dedication
  • obb=other books by

I like to roundtrip the TOC links to front matter, parts, chapters, and back matter so readers can get back to the TOC by clicking on the title of each part and chapter within the ePUB. I have a RegEx that adds an ID to the TOC items that is the same as the text after the underline in the file name. Because I use the text after the underscore as the location ID, I start the text with a letter and run the text together.

With the image files, I like to name them so I know where the images appear in the ePUB and what order images in a single chapter appear. The file names include the chapter the image appears in and the order it appears, so “c01i01” is the first image that appears in chapter one. It often makes sense to add an underscore and a brief description to the image file name so you know what each of the images is as well.

6 Responses to “Naming Conventions for ePUB Files”

  1. And just yesterday I noticed that working in a *folder* with special characters caused a problem. I couldn’t unzip an epub with the AppleScript ePub UnZip 1.0 because it was in a folder called “Start a Business for Less Than $2000”. The dollar sign was causing an error for the apple script!

  2. Matthew says:

    Colleen, thanks for also pointing out this video, “Mac Tips:(Automator Tutorial) How to rename multiple files in OS X” here It is a walkthrough of how to use Automator to rename multiple files.

  3. settusurf says:

    I am getting error in epubcheck:

    “non-standard stylesheet resource ‘OEBPS/page-template.xpgt’ of type ‘application/vnd.adobe-page-template+xml’. A fallback must be specified.”

    How to fix this error? Thanks in advance.

  4. Ramesh says:

    Converted HTML files (extracted from ePub) to PDF manually. Then asked there you should be naming convention for HTML files and there is your article on same subject 🙂


  5. Takao says:

    I had the following error too.

    “non-standard stylesheet resource ‘OEBPS/page-template.xpgt’ of type ‘application/vnd.adobe-page-template+xml’. A fallback must be specified.”

    We only have a solution that makes PDF?

    Thank you for your cooperation.

  6. Pious says:

    This is added in new version of validator.
    ePubcheker 3.0 won’t report this as an error.
    If you really don’t need this line in coding, you can remove. it’ only for viewing file in ADE.