Adding hidden URLs to XML in InDesign

New Here ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

Hello everybody, I have a question about adding hidden URLs to XML text in InDesign.

We use InDesign to create PDFs and to export XML. The latter is in turn converted to HTML by using an XLST. The problem is that we usually have a lot of one-off, unique URLs *behind the text* which are not included in the XML file. How can we add the hidden URLs to the XML text?

TOPICS
Import and export

Views

110

Likes

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

Adobe Community Professional , Apr 02, 2022 Apr 02, 2022
Well, yeah, it means manually, or with a script, but not manually like you mean. It's worse, actually; you'd have to go to each URL element in the Structure pane, and add the destination there. You'd need to add a new Attribute in the Structure panel. Right-click on the URL element in the Structure pane, choose "Add element..." and then add a destinationURL attribute with the contents of your link. So it'd wind up looking like this onscreen: That's actually more clicks, I think, then trying...

Likes

Translate

Translate
New Here ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

PS.: InDesign 16.4.1

Likes

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
Adobe Community Professional ,
Mar 29, 2022 Mar 29, 2022

Copy link to clipboard

Copied

I have a feeling that you'd need to give us a bit more info before we could actually answer your question. I mean, I have made a few test documents over here, but I don't know how your document is structured, so I can barely even guess at suggestions to make. Text or frames that are tagged should be included in XML export, even if they are hidden (either by moving the item to a new layer, then hiding the layer, or by selecting the object and going to Object -> Hide). At least, that's how it behaves over here when I test it.

 

How are your hidden URLs hidden? If you select 'em and go to Windows -> Utilities -> Tags, are they tagged? If not, tag 'em! Then they'll export with your XML. 

 

 

Likes

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
New Here ,
Apr 01, 2022 Apr 01, 2022

Copy link to clipboard

Copied

Hi Joel,

 

thanks for your answer! With "hidden" URLs I meant that the link as such is not visible in the text but still working and part of the file, see "Screenshot_InDesign_XML.png" and the screenshot of the same file exported to PDF, see "Screenshot_PDF-png". We do not want our links to look like the last link in the text, however, this is the only way I have found so far that links get exported as XML, whereas the other links are not included in the exported XML file (see screenshot of XML file opened in a text editor, "Screenshot_XML_in_Text_Editor.png").

How do I tag links for XML that are only visible in the Hyperlinks panel but not in the text itself? I have searched quite extensively for a way to do this and not found an answer. Thanks in advance!

 

Likes

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
Adobe Community Professional ,
Apr 01, 2022 Apr 01, 2022

Copy link to clipboard

Copied

I am on my phone right now and so therefore I don't know for sure if this is the answer, but I am pretty sure that this  discussion is an answer to your question. I'll be able to check it this evening to make sure, but you want both the displayed link text and the actual contents-of-the-hyperlink text to be included with your XML export, and the way to do that is apparently by scripting it! Or at least by some manual paste work on each hyperlink. 

Likes

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
New Here ,
Apr 02, 2022 Apr 02, 2022

Copy link to clipboard

Copied

Thanks Joel! I came across the thread you referenced while Googling my problem, the thing is, I do not know how to tag URLs that are not included in the text itself, and have been unable to find any information on how to do this. Does this mean that I would have to copy each URL and insert it after the link text (manually (ugh!) or with a script)? This is precisely what we want to avoid, since we want to keep the text readable - with up to 30 - 40 links in one 2,000-word text. Or is there a possibility to copy/paste the URLs in the XML data, but not in the text? Thanks again in advance!

Likes

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
Adobe Community Professional ,
Apr 02, 2022 Apr 02, 2022

Copy link to clipboard

Copied

Well, yeah, it means manually, or with a script, but not manually like you mean. It's worse, actually; you'd have to go to each URL element in the Structure pane, and add the destination there. You'd need to add a new Attribute in the Structure panel. Right-click on the URL element in the Structure pane, choose "Add element..." and then add a destinationURL attribute with the contents of your link. So it'd wind up looking like this onscreen:

 

JoelCherney_1-1648929041253.png

 

That's actually more clicks, I think, then trying to do it by hand in the XML output! But it's not hard to imagine a script that

1) runs through the doc until it finds a tagged URL that has no destinationURL attribute

2) extracts the Hyperlink Destination from the Hyperlink

3) adds a destinationURL Attribute to that tag

4) adds the hyperlink destination extracted in 2 above to the Value for the freshly created Attribute

 

or something along those lines. Depending on the total volume of links to process, and the frequency with which you'd have to re-do this work, it might make a lot of sense to write that script. Honestly, if I didn't have hundreds of links to process, I'd be inclined to use AutoHotkey to make the copy-Hyperlink-Destination-from-InDesign-and-paste-into-Notepad++ action into a single keystroke, but that's because I feel like it'd be faster for me, personally. (I stumble through old-dialect Javascript quite slowly, but I feel like I can automate a repetitive copy/paste task in AutoHotkey's scripting language in just a few minutes.)

Likes

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
New Here ,
Apr 19, 2022 Apr 19, 2022

Copy link to clipboard

Copied

LATEST

Thanks again, Joel! We will have a look at both the Java Script and the AutoHotkey option. Just wondering if a Java Script would be able to extract the proper hyperlink destination for a given link, but I suppose that is a question for a new post.

Likes

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