Skip to main content
Participant
January 10, 2023
Answered

internal hyperlink of an image in an epub

  • January 10, 2023
  • 1 reply
  • 1269 views

I'm new to InDesign, I was looking for a solution to give an icon a hyerlink that leads to a paragraph in the same document as an epub. Is there any solution for this?

This topic has been closed for replies.
Correct answer James Gifford—NitroPress

thanks for the answer, it seems to sound good, when you find a moment, could you explain the second solution in detail to set the paragraphs without the text but only with the images please?


Since the graphic or icon has to be "inline" with text, it's not possible to accomplish this linking without text; a freestanding graphic frame would not work properly in reflowable EPUB (it must be anchored within the primary text flow).

 

My secondary comment means that instead of putting up with the limitations of an inline graphic within an existing paragraph, formatted for other purposes, it is possible (and suggested) that specific image-anchor paragraph styles be used. Instead of anchoring a click-icon to, say, Body Text, where its positioning etc. would be controlled by the characteristics of the Body Text style, creating a style called Icon Center would let you center the click icon, space it from other text, and apply other characteristics unique to the icons. This would also allow more precise CSS formatting control, if desired.

 

But one way or the other, the graphic frame has to be anchored to text, using the Inline method, for the link to work.

 

1 reply

James Gifford—NitroPress
Legend
January 10, 2023

InDesign has fairly comprehensive link and cross-reference features. Either might work for this purpose; cross-refs in particular are very flexible and can be used to get around TOC and Index feature limitations. Both generally work properly in EPUB exports.

 

Take a look at Type | Hyperlinks & Cross References. Questions as you have them!

 

KimerAuthor
Participant
January 10, 2023

Thanks for the answer,

I briefly describe the steps I do. I set the cursor on the text and from the Hyperlinks menu, I go to New Hyperlink Destination, then I give a name to the Hyperlink created in Text Anchor. Then I go to the image and create New Hyperlink and select the previously created target hyperlink. But it doesn't work once the file is exported. I tried using the image as a button, and targeting the text-anchored hyperlink, but it didn't work.. I tried exporting to both epub 3 and epub 2.. no change...some any idea what's wrong?

James Gifford—NitroPress
Legend
January 10, 2023

I see what you mean.

 

First, I always forget that the hyperlink stuff is a little fragmented. It is easier to go to the Hyperlinks pane (window) and work from the drop-down menu there, as it includes the text anchor function whereas the menu item does not.

 

But in quick testing, I find that a hyperlink within an EPUB only exports correctly if it is text-based. Selecting an image and applying the hyperlink in InDesign results in an export with the hyperlink essentially invisible, the <a> and </a> bracketing nothing, in the export code.

 

I am not sure offhand what the solution is but I know it can be done; it may just be that ID will not export the code correctly and it will have to be fixed in the XHTML file of the exported EPUB. That doesn't sound right, though; let me experiment and see if I can figure out the glitch.