• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

internal hyperlink of an image in an epub

Community Beginner ,
Jan 10, 2023 Jan 10, 2023

Copy link to clipboard

Copied

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?

TOPICS
EPUB

Views

208

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 12, 2023 Jan 12, 2023

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 anchorin

...

Votes

Translate

Translate
Community Expert ,
Jan 10, 2023 Jan 10, 2023

Copy link to clipboard

Copied

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!

 


╟─ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ─╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 10, 2023 Jan 10, 2023

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2023 Jan 10, 2023

Copy link to clipboard

Copied

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.

 


╟─ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ─╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2023 Jan 10, 2023

Copy link to clipboard

Copied

I'm baffled.

 

As I noted, InDesign will export the link but leave it detached from the image, with no clickable elements within the <a> brackets. This is if the link is applied to the graphics frame. If the link is applied to the graphic itself, the link text simply disappears in the export.

 

But... if in the first case I cut and paste the <a href=...></a> pair around almost any of the image elements (<img>, <div>, etc.)... it works fine in EPUB 3 (Calibre Reader). So it seems to come down to InDesign not wanting to apply a link that is in all other ways valid to a graphics object.

 

I don't know if this is a standards issue or just an ID implementation quirk. I need to run a couple of these variations through epubcheck to see if it throws any errors.

 

ETA: EPUBcheck throws a MIME error if any variation of the <a> wrapper is moved around the graphic. But all variations work fine in Calibre Reader.

 

But there's (lousy) answer number one: you could edit the link text in the EPUB's XHTML file to get the icon to be an active hyperlink, but at the cost of a validation error. I don't think much of validators/validation in general, but I loathe doing surgery on generated files and don't really suggest this; I'll keep working at a better solution, hopefully one worth including in the Guide.

 

Stay tuned. 🙂

 


╟─ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ─╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 11, 2023 Jan 11, 2023

Copy link to clipboard

Copied

thanks for the reply, I will follow the post very carefully, I have activated email notifications, any news will be welcome

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 11, 2023 Jan 11, 2023

Copy link to clipboard

Copied

A-ha!

 

A breakthrough, although I haven't fully explored it yet. Changing the image/icon to "Inline" anchored (instead of no anchor, which won't work in reflowable EPUB anyway, or "Custom" as used to place an image on a page in a general way) — making it "Inline" makes the linking work perfectly.

 

If you want an icon that's not associated with any particular text, the solution is probably to create a paragraph style called "Anchor Point" or some such, and use it to position and anchor (inline) the icon or graphic.

 

More experimentation underway.

 

ETA: And I think that's the complete basic solution for EPUB. InDesign does not export any of the text-wrap or positioning information, only a "clean link" and the characteristics for the anchor paragraph. So using Anchored, Inline and positioning it within the work document using a dedicated paragraph style, which can then be modified using CSS if desired, is a completely working method to use a graphic or icon as an internal document link.

 


╟─ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ─╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 12, 2023 Jan 12, 2023

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 12, 2023 Jan 12, 2023

Copy link to clipboard

Copied

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.

 


╟─ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ─╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 12, 2023 Jan 12, 2023

Copy link to clipboard

Copied

Thanks for the answer, all clear now, may thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 12, 2023 Jan 12, 2023

Copy link to clipboard

Copied

LATEST

Thanks for the question! I hadn't realized I had this hole in my understanding of ID-to-EPUB and I'm glad to have filled it in.

 


╟─ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) ─╢

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines