Join Michael Murphy for an in-depth discussion in this video Taking advantage of conditional text, part of InDesign CS6: HTML.
In the last movie, we looked at setting up and applying hyperlinks to text in a print layout. But one of the fundamental differences between print and the web, is that you can't click on or follow a hyperlink on a printed page, as you can on a web page. As a result, web references in print tend to look like they do here. Where it'll say something like, contact us at and show a full email address or a phrase like, visit the website at and the full URL.
Online however, you're more likely to make a link out of the phrases, contact us at or visit us at, rather than to show the full email address or the full URL in the text of the webpage. Using InDesign's conditional text feature you can actually accommodate both presentation options for print and the web in the same document. Let's take a look at how that's done.
At the moment, for this email, only the email address is the active hyperlink. This part of the phrase is not. You can tell that by the highlighting, here, the email address is not highlighted. But when I select this, it is. I'm going to select the entire phrase now, and from the Hyperlinks Panel menu, I'm going to choose Reset Hyperlink. Now that hyperlink applies to the entire phrase. You can see if I just take a little bit of it here in the contact Alcatraz Cruises phrase, I see that the hyperlink is highlighted here as well, so this whole phrase is now the link.
I've expanded it by resetting it. I'm going to do the same thing here by selecting this entire phrase. Visit their web site with the URL in parenthesis. Go to the Hyperlinks Panel menu and choose Reset Hyperlink. Now the hyperlink is applied to the entire phrase as well as the URL. Now that both the phrase and the actual links are hyperlinks, I'm going to selectively hide the portions of this that I don't want to see on the web. For the email link that's everything after LLC.
So it's the space, the word at and the full email address. To hide that, I need to create a condition for just this print information. So I'm going to go to the Conditional Text Panel, which I have open because it's part of my print to web workspace, but if you're looking for it, it's under Window, Type & Tables, Conditional Text. I'm going to go to the Panel menu and choose New Condition. I'll call it Print Only, and for an indicator, which is how InDesign shows you that conditions are applied to text in your layout, I'm going to choose Highlighting, I prefer that to underlining, and for the color, I tend to pick something that I would never use as part of my design.
So, let's say this Grid Green color here. I'll click OK, and I've created the condition but I haven't applied it yet. In order to apply it, I have to click in this little box, right next to the condition name and that applies the condition. When I Deselect, you can see there's that bright green highlighting showing me that this condition is applied. If I want to hide that text I'll just click this little Visibility icon next to the condition name and see that it disappears. Now all we're left with is contact Alcatraz Cruises LLC.
If I select that phrase, you can see that my hyperlink is selected. This is a working hyperlink. I can do the same thing down here after the visit their website phrase and get rid of the space after the word website and this entire URL and the closing parenthesis. I'm going to apply the Print Only condition by checking this box, and because the condition was already hidden, the text disappears immediately. When I toggle it back on all the text is restored as it originally was.
When I turn it off, this is my preferred content presentation for HTML. I'm going to save this file now as 03-04 end.indd, and I'm going to export this as HTML to my desktop. I'm not going to change anything here because this is purely a functionality test. I don't have any images and I don't want any CSS. I'm not interested in how any of it looks. I just want to make sure that it exports the way I want. So I'll click OK. And here you can see it in my browser.
I have two phrases that are links, but I'm not actually seeing the URL. The first phrase, Contact Alcatraz Cruises LLC will open up my email client. The second, visit their website, will open up my browser and go to the webpage indicated in the hyperlink. This is a much more reader friendly or user friendly presentation on the web. Where the phrase itself is the direction. The hyperlink appearance and behavior is the interactivity with the user.
And it's not bogged down by all that extra text of a fully spelled out URL. Or a fully spelled out email address. However, whenever I need to use this layout for print again, I can just go back to InDesign, toggle on my Print Only condition, and work with the layout from there. I can export it to PDF, package it up for my printer, and I have a hybrid presentation of my content that'll work for both purposes.
- Connecting InDesign styles to HTML tags and CSS classes
- Controlling the order of exported content
- Exporting just the content you want
- Bringing sidebars and pull quotes into HTML text flow
- Adding hyperlinks to images and text
- Replacing InDesign's CSS with a custom CSS
- Generating web-optimized images from print layouts