Shopify Articles

Etherycle sometimes blogs about ways to make you more money!

We recently launched a book, and one of my requirements for the project was that it had to be available in real ebook formats - not just a crappy PDF that people were supposed to read on their computer screens. I do most of my reading on a Kindle Paperwhite, and I love it. It does one thing, and it does that one thing great. Of course, now the onus fell on me to make the ebook happen, so here's the process I used. I'm not saying this is the "correct" or "only" way, just the one that worked best for me. You'll end up with EPUB and AZW3 files that should be readable pretty much everywhere.

Kurt and I wrote Ecommerce Bootcamp collaboratively in a Google Doc, then I did a final pass on it in LibreOffice. The fact that we had already written it in word processing software made the GUI-heavy iBooks Author feel like more trouble than it was worth (plus WYSIWYG editors are tools of the devil). So I just took our ODT file and used Calibre to convert it to EPUB. If you read a lot of ebooks, Calibre is a must-have tool for converting between file formats, tagging your books, and fixing them so they (correctly) use left justification instead of (clearly incorrect) full justification.

This resulted in a sloppy EPUB file. The words themselves were correct, but the font sizing, spacing, alignment, etc were inconsistent and not what I wanted. Now here's something your might not know: EPUBs are just zipped-up HTML and CSS files with a little bit of extra stuff thrown in. You can use a simple tool like eCanCrusher to “unzip” your EPUB and you get this:

From here you can use a text editor to edit the HTML and CSS to do whatever you want. You're essentially making a visually pleasing text-based website. Because I'm picky, I just put in the raw text and hand-coded the whole thing. I wanted to make sure all my heading sizes were correct, what would be ordered lists vs. what would be unordered lists, blockquote margins, etc. TextMate's Option-Shift-W is your friend. The CSS is pretty simple and you can use it to define exactly how your text is laid out. Chapter breaks are done by adding page-break-before: always; on each H1.

See the Pen EPUB CSS by Paul Reda (@paulreda) on CodePen.

Calibre's EPUB exports use an older standard of the format that was based on XHTML and CSS2, so when you're marking up your book, pretend it's 2004 again. Complete with weird browser quirks! (Such as Nook readers might barf if you use CSS shorthand like margin: 10px 0;)

Everything else in your unzipped EPUB should be pretty straightforward. A folder with images you may be using, the title page of your book, and content.opf, which acts like a <head>for your book. A file you will need to worry about editing is toc.ncx, which is the Table of Contents.

See the Pen EPUB TOC by Paul Reda (@paulreda) on CodePen.

Just add a navpoint for each chapter, and have it link to an anchor tag inside the text of your book. Again, it's just like making links within a page.

After you get things working right in your EPUB folder, run it back through eCanCrusher to get it back to a single file. Now you can take that, pop it back in Calibre, and convert it to whatever other ebook formats float your boat. Remember, we're back in 2004, so it's a good idea to load it onto different devices and do some "browser testing" to make sure everything looks fine.