Conditional Hyperlinks


when I link to another book from my eBook, I want to do the following:

in my kindle eBook, the link should point to the other book in the kindle store
in my iBook eBook, the link should point to the other book in the ibook store.

another use case: If I include a link to my website, I want to include a flag that indicates if the link comes from the kindle eBook, from the iBook or from the pdf version.

Is there a way to automate this? So that the right link is selected depending whether I compile for the kindle or for the iBook or for the PDF version?


The only way would be to use a different document for each occurrence, and including different documents for each Compile. That would be easy if these links only occur in front matter documents, but if they occur throughout the book, it would be more of a hassle.

It’s throughout the book. Thanks for the answer.


What about the Replacements tab in Compile? You could put in simple text like “http:linktowebsite” and “http:linktobooks”, and then in the replacements tab, you could have it replace the first with the complete and correct URL to your website that includes where the link is coming from, and the other with a link to another book on the appropriate e-book retailer’s site. You would then save one preset as your “” compile preset, change the URLs for iBooks and save that preset as your “iBooks” preset.

That won’t work because it will only change text, not the underlying links.