Hyperlinks & bookmarks
The Hyperlink element, its text source and its URL, page or text destination, and Bookmark — spelled the way InDesign 20.0.1 reads them.
A hyperlink joins a source in the story to a destination by id; a bookmark is a destination with a name and no source.
In short The linked words are wrapped in a HyperlinkTextSource inside the story.
The place they jump to is a destination: a HyperlinkURLDestination or a
HyperlinkPageDestination in the design map, or an inline HyperlinkTextDestination
marker in a story. A Hyperlink in the design map joins the two: Source is an
attribute, and the destination is a typed <Properties><Destination type="object">
child that names it as Type/Self. InDesign binds these elements only when they come
after the last idPkg:Story reference.
One hyperlink: a text source in the story, a URL destination and the Hyperlink that joins them, placed after the story reference.
Hyperlink: the join
Hyperlink is a direct child of Document. It carries the source as an attribute and
the destination as a typed property:
Sourcenames the source'sSelf(for text, aHyperlinkTextSourceid).<Properties><Destination type="object">HyperlinkURLDestination/urldest</Destination>names the destination as its element type, a slash, and itsSelf.Visible,Highlight,Width,BorderStyleand the typedBorderColorproperty describe the link rectangle in exported PDF.
These rules were measured in InDesign 20.0.1:
- A
Destinationattribute is ignored. The link opens unbound. Destinationattribute plusDestinationUniqueKeymakes the file unopenable.DestinationUniqueKeyon its own is optional. It neither helps nor hurts binding.
| Attribute · Hyperlink | Values | Paged | paged.set |
|---|---|---|---|
| Destination | reference | read · written | |
| Hidden | false | written | |
| Name | real / text | read · written | |
| Self | id / reference | read · written | |
| Source | id / reference | read · written | |
| Visible | boolean | written | |
| BorderColor in Properties | — | written | |
| BorderStyle | enum | written | |
| DestinationUniqueKey | integer | read · written | |
| Highlight | enum | written |
The source: HyperlinkTextSource
A text source wraps the characters that are clickable. InDesign writes it inside the
CharacterStyleRange, around the Content it covers, so a link in the middle of a
sentence splits the range's content into three parts: the text before, the source, and
the text after. Some generated files wrap whole CharacterStyleRanges in the source
instead.
| Attribute · HyperlinkTextSource | Values | Paged | paged.set |
|---|---|---|---|
| AppliedCharacterStyle | reference | not read | |
| Hidden | boolean | written | |
| Name | real / reference | written | |
| Self | id / reference | read · written | |
| AlternativeDestination in Properties | — | not read |
A page item can be a source too (HyperlinkPageItemSource), but none of the 305
documents in the census uses one.
Destinations
A hyperlink lands on one of three kinds of destination.
HyperlinkURLDestination opens a web address, DestinationURL. It is a direct
child of Document.
| Attribute · HyperlinkURLDestination | Values | Paged | paged.set |
|---|---|---|---|
| DestinationURL | reference | read · written | |
| Hidden | false | written | |
| Name | reference | written | |
| Self | HyperlinkURLDestination reference | read · written | |
| DestinationUniqueKey | integer | read · written |
HyperlinkPageDestination jumps to a page in the same document: DestinationPage
names the page's Self, and ViewSetting / ViewPercentage say how the viewer frames
it on arrival. It is also a direct child of Document.
| Attribute · HyperlinkPageDestination | Values | Paged | paged.set |
|---|---|---|---|
| DestinationPage | id | read · written | |
| Hidden | boolean | written | |
| Name | real / reference | written | |
| Self | reference | read · written | |
| DestinationPageSetting | enum | not read | |
| DestinationUniqueKey | integer | read · written |
HyperlinkTextDestination marks a spot in the text. InDesign writes it as an empty
element at that spot inside the story, with Self, Name and Hidden; it is not a
design-map element. A HyperlinkTextDestination in the design map, with a
DestinationText attribute, appears in some generated files; InDesign does not bind it.
Text destinations are what cross-references and bookmarks usually point at.
Bookmark
A bookmark is an entry in a PDF's navigation pane. It has a Name and a Destination
attribute naming a text or page destination, and no source in the text. Bookmarks nest:
a Bookmark inside another is its child in the outline. Like hyperlinks, bookmarks bind
only after the last story reference.
| Attribute · Bookmark | Values | Paged | paged.set |
|---|---|---|---|
| Destination | reference | read · written | |
| Name | enum / text | read · written | |
| Self | id / reference | read · written |
In Paged: a hyperlink's destination is found from the typed property, the older attribute, or
Supported · verifiedDestinationUniqueKeyresolved through the destinations' keys. Text sources become PDF link annotations, to a URL or to a page; the border and highlight are not drawn. Page-item sources are not read. Bookmarks are kept and saved back. Scripts can add a hyperlink to a URL or a page, but not edit or remove one, and saving writes InDesign's spelling, rewriting a file in the older engine spelling.
Frequently asked questions
How does a Hyperlink name its destination?
With a typed property: <Properties><Destination type="object">Type/Self</Destination></Properties>,
for example HyperlinkURLDestination/urldest. A Destination attribute is ignored.
Where does a text destination go?
Into the story, as an empty HyperlinkTextDestination element at the anchored
position. InDesign does not bind a text destination written in the design map.
Is DestinationUniqueKey required?
No. On its own it changes nothing; next to a Destination attribute on the same
Hyperlink, it makes the file impossible to open.
Where do the hyperlink elements go in the design map?
After the last idPkg:Story reference. InDesign ignores destinations, hyperlinks and
bookmarks that come before the stories.
What is the difference between a hyperlink and a bookmark? A hyperlink has a source in the text that a reader clicks. A bookmark has none: it is a named entry in the PDF's navigation pane that jumps to a destination.
Cross-references & hyperlinks
How an IDML document points at the web and at itself — hyperlinks, bookmarks, cross-references, index markers and tables of contents, and where each lives.
Cross-references & the index
CrossReferenceSource in the story, CrossReferenceFormat and its building blocks, the Hyperlink that joins them, and the Topic and PageReference index markers.