Hyperlinks in InDesign Interactive Publications

The idea behind using an interactive document is that users will tend to become more engaged with the document. Hopefully, this means that readership increases with comparative desired results. To explore how the new Publish Online (technology preview) feature for InDesign CC 2015 works with hyperlinks we created a sample document for testing.To compare performance, we also exported the document to interactive PDF and Fixed Layout EPUB.

HOW THE DOCUMENT WAS CREATED

The document was created with three master pages:

  1. Master Page A contains all of the elements that are required for every page:
    • Buttons to use as hyperlinks to the document sections.(Navigation Buttons)
    • Text to use as hyperlink to external web site
    • Trailer that appears on every page
    • Buttons to take user to previous and next page (GoTo Buttons)
  2. Master Page B
    • Master page used for Glossary pages.
    • Has only one element: a back arrow to take the user to the previous view (returns to page with text that linked the user to the Glossary page)
  3. Master Page C
    • Based on Master Page A.
    • Used for the front page of the document

NAVIGATION BUTTONS

A set of images are placed on Master Spread A to act as navigation buttons. The containers for the images are named using an incremented naming convention.

  • Last two characters of name is the index for its hyperlinked page.
  • All but last four characters is name of hyperlink.

Using this convention, a script (Hyperbuttons) was used to create hyperlinks for the image containers. Within a repeat loop, the following creates the hyperlinks (partial script).

   set rectRef to item i of rectList
   set rectName to name of rectRef
   set pageIndex to (text -2 thru -1 of rectName) as integer
   set hyperName to text 1 thru -4 of rectName
   set pageRef to page pageIndex of docRef
   tell docRef
      if not (exists hyperlink page destination hyperName) then
         set hyperDest to make hyperlink page destination with properties (name:hyperName, destination page:pageRef)
         set hyperSource to make hyperlink page item source with properties (source page item:rectRef)
         try
            make hyperlink with properties (source:hyperSource, destination:hyperDest)
        end try
      end tell 

GOTO BUTTONS

Buttons from the Sample Buttons and Forms Library were placed on Master Spread A to provide go to previous page and go to next page behavior. A single back button was also placed on Master Spread C to provide go to previous view behavior.

BOOKMARKS

A script was also used to provide PDF Bookmarks for the document. Bookmarks for PDF can also be established using the Table of Contents feature in InDesign. Either method relies on a specified paragraph style to determine the text and link for the table of content entry. The paragraph style used in this document was named “Destination.”

HYPERLINKED TEXT

To provide hyperlinks to text definitions in a glossary, another script was used. The script relies on the following:

  • Character style “Hypersource” exists in target document.
  • Glossary items are within a single text flow identified by story name “Glossary.”
  • The Glossary text destination is styled with a character style “Glossary” and is the first text style range for each glossary item.
  • All text is within a single text flow identified by story name “BodyText”.
  • Only Body text in story named “BodyText” is styled using the paragraph style “Body.”

As part of the process, the script gets a reference to all hyperlinked destination text (first text style range for each glossary item). Using this list it gets a list of all body text having the same text content as the destination. With this, the hyperlinks are created for the document using the character style “Hypersource” to style the hyperlink source text. The code that creates the hyperlinks is as follows:

   if not (exists (hyperlink page destination destName)) then
      set hyperDest to make hyperlink page destination with properties {name:destName, destination page:pageRef}
   else
      set hyperDest to hyperlink page destination destName
   end if
   repeat with i from 1 to length of foundSet
      set hyperSourceRef to item i of foundSet
      set hyperSource to make hyperlink text source with properties {source text:hyperSourceRef, applied character style:charstyleRef}
      make hyperlink with properties {name:(wordStr & i), source:hyperSource, destination:hyperDest}
      set hyperCount to hyperCount + 1
   end repeat

Note: The variable hyperCount is a global variable set at the top of the script. It is used to display a dialog to report the number of hyperlinks created. For our simple document there were 28 hyperlink text references. Once you have a script such as this, it is a heck of a lot easier to run a script than it is to find a list of text references and create hyperlinks.

For the complete HyperGlossary script, check out our Feature page for the entire script. It will be the featured script for the month of July.

TABLE OF CONTENTS

For the EPUB version of our document, a Table of Contents was created using the Destination paragraph style as the content item.

HYPERLINK TEST RESULTS

Test 1: The test document was first saved as an interactive PDF. All hyperlinks performed as expected.

Test 2: Saved as a fixed layout EPUB. Viewed in Adobe Digital Editions, the goto Buttons were a little flaky and the go to previous view button did not work at all. But the text hyperlinks worked as expected as did the navigation buttons (images). Notice the table of content listing at the left of the page.

Publication viewed on Digital Editions

Viewed in iBooks, the behavior was similar to that in Digital Editions.

 Inside page viewed on iPad

Test 3: Saved using the new Publish Online (technology preview), the hyperlinked buttons (images) worked as anticipated. The GoTo page buttons and the text hyperlinks did not work. 

The text hyperlink I really wished would work is the URL hyperlink. The GoTo page button issue can be overlooked for now because the Publish Online document gets an Option bar which includes a control bar by default. The first button on the bar opens the navigation thumbnails panel.

Published Online; notice navigation thumbnails

CONCLUSION

For a “public beta” feature, text hyperlinks is the only real negative that we have found so far. So, for those in the US and Great Britain, you can play with the Publish Online feature and wait for the next release of InDesign to hopefully make it real. I see great possibilities for using this feature in education as well as within organizations (training, sales, and documentation to name a few).

For instance,click on this link ;to see our sample document. Experiment with the control panel at the bottom of the display and start making a list of how you can take advantage of Publish Online.