Link to an Attachment
On this page, you’ll learn:
-
How to create a link to an attachment.
Attachment files are stored in an attachments family directory.
Currently, you can’t reference an attachment using an Antora resource ID. |
Create a link to an attachment
An attachment is a resource, such as a PDF or a sample project ZIP archive, that a visitor can download from your site.
To insert a link to an attachment in a page, use the AsciiDoc link macro (link:[]
).
link:{attachmentsdir}/example.raml[Download the RAML example] and run it.
Let’s break this down.
You start with the link macro prefix, link:
.
Next is the target.
Start the target with the {attachmentsdir}
attribute reference to tell Antora where to look for the file.
Then put the relative path of the attachment file after that.
Finally, end with the text of the link (as the reader will see it) between a pair of square brackets ([]
).
You don’t need to set the path to the attachments directory in the header of your file. This is managed automatically by Antora.
Links to attachments can also be added to the site navigation.