Ahab! Is a .mobi template for helping you produce Amazon Kindle specific ebooks.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



A baseline Mobi template

sssssyyyssoo+//:::://+++++++oo+/:---../o. `.:ohddhhhhhdmmdhy//+osossssss

It's like 2003 once again, and all our business cards say "Webmaster"

by Craig Mod - http://craigmod.com (c) Everyone


Super-simple baseline .mobi templates. Here ya go.

It's also meant to be a bit geeky. It's for those of us who like to hand-code websites. Who want to know what's going on under the hood. Who are obsessive about CSS class naming and indent styling and get pleasure knowing the innards of the machines they produce are as beautiful and effecient as possible.


Mobi is Kindle's ebook format. It's sort of like EPUB's step-brother. If you have a properly produced .mobi file you can publish on the Kindle Direct Publishing platform.

Why .mobi? Pareto priciple ("80/20 rule"). I want to leverage existing marketplaces for digital publishing, and Amazon covers 80%+ of the market I'm interested in reaching. iBooks just doesn't have the audience, nor is the platform presently inviting (IMO) from a systems and ubiquity perspective. Kindle hits iPad, iPhone, Android, web, desktop ... EVERYWHERE. And it does seamless syncing. I like all that. Readers like all that.

There's other engaged and energized communities emerging around products like Readmill but I don't want to have to deal with selling stuff on my own. And I do want to sell stuff. That's part of the experiment. And, I think it behooves anyone interested in the future of publishing to know the biggest guy in the room really well, even if you don't like them. (I've got nothing against Amazon but it seems like a lot of other folks do.)

This template

This template is meant to get you from thinking about publishing a piece of text you have to actually publishing it on Kindle Direct Publishing. If you have a long-form blog post composed mainly of text, I suspect you could convert it to a proper .mobi file using this template in fifteen minutes. Obviously, more complex texts (and cover production, etc) take more time.

So this template is mainly about minimizing friction.


If you prefer, you may use a COMMAND LINE PROGRAM, kindlegen, to make .mobi files from your content.opf, but Kindle Previewer will do the same.

After you install Kindle Previewer, open it and drag your carefully crafted content.opf it into the Kindle Previewer. It will then covert it to a .mobi file in the Compiled-content.opf/ directory. Kindle Previewer then opens the content.mobi file it spits out.

You should read the Compilation Details just to see if it warns of something crazy.

Kindle Previewer is pretty kludgy, but it gets the job done. It saves you from trying to send .mobi files to seven different devices. And speeds up development / testing / iteration time.

You will, at some point, want to send something to a bunch of Kindles. This utility is useful for that:

There are a lot of people out there who have spent a lot more time working on this stuff than I have. I referenced Liz Castro's blog any number of times.


So Amazon revised their cover guidelines in early 2012. Here's the latest:

Here are the base requirements:

Requirements for the size of your cover art:

• Minimum of 1000 pixels on the longest side • Ideal height/width ratio of 1.6

For better quality, we recommend that images be 2500 pixels on the longest side.

The 1.6 ratio bit is weird. It's the dimensions for the Kindle Fire, which I have to admit, feels odd. This is partially awkward since hardware eink Kindles have a screen ratio closer to 1.3.

Amazon currently doesn't offer the ability to include multiple covers for their different devices. I feel inclined to design for hardware Kindles since I'm still not convinced anyone actually uses/reads on first generation Kindle Fires.

For some reason, .png is not allowed for cover images. So make sure you stick with .jpg or .tiff. .pngs are allowed everywhere else.


Kindle Format 8 supports CSS media queries. It seems a little bit out of the scope of a baseline template, but if you're interested, Liz Castro explains all.

@font-face rules only work on Kindle Fire.

Actually, a lot of css rules only work on Fire. Floats, for example. The simpler you keep your CSS, the saner you'll be.

Here's the full list of KF8 HTML and CSS support:

What are these other files?

Toc.ncx & content.opf are the two slightly alien files of this collection.

OPF means "Open Packaging Format". From Wikipedia:

The OPF file, traditionally named content.opf houses the EPUB book's metadata, file manifest, and linear reading order. This file has a root element package and four child elements: metadata, manifest, spine, and guide. All of these except guide are required. Furthermore, the package node must have the unique-identifier attribute. The .opf file's mimetype is application/oebps-package+xml.

The .ncx file is explained thusly:

The NCX file (Navigation Control file for XML), traditionally named toc.ncx, contains the hierarchical table of contents for the EPUB file. The specification for NCX was developed for Digital Talking Book (DTB), is maintained by the DAISY Consortium, and is not a part of the EPUB specification. The NCX file has a mimetype of application/x-dtbncx+xml.

Exciting stuff! zzzzzz

I've done my best to obviate thinking too much about these files.


So you have your cover. You have your properly formated .mobi. You've tested it in Kindle Previewer and it looks pretty good on all the devices. Now, how do you publishg?

You can just mail the .mobi file to friends, put it up on a server, upload it to a forum — distribute any way — and any Kindle will be able to open the file.

But if you want to "publish" it on Amazon — set prices and get it properly listed —  then Kindle Direct Publishing is what you want. It should be pretty self explainatory.


This is by no means exhaustive. It's meant to give anyone interested in .mobi a little boost. I've tried to strip away all the unnecessary gunk. What's remaining should be relatively self explanatory.


If you do end up making a publishing something with this, please let us know. Post about it in the github project or shoot me an email: me@craigmod.com


A 'satellite' post on craigmod.com about this template lives here: http://craigmod.com/satellite/ahab/