Content
In Word DOCX document templates, you can add dynamic hyperlinks and endnotes. This article will provide examples demonstrating how to create dynamic hyperlinks pointing to web locations, as well as how to add endnotes and footnotes.
You can download the template and the result document for the examples described below in links and endnotes demo.
Suppose you have a list of online learning resources, and you want to automatically create hyperlinks for each.
Here’s the structure of our JSON:
[
{
"name": "The Open University",
"description": "Distance and online courses. Qualifications range from certificates, diplomas and short courses to undergraduate and postgraduate degrees.",
"linkName": "Go to the site",
"linkURL": "http://www.openuniversity.edu/courses"
},
{
"name": "Coursera",
"description": "Online courses from top universities like Yale, Michigan, Stanford, and leading companies like Google and IBM.",
"linkName": "Go to the site",
"linkURL": "https://plato.stanford.edu/"
},
{
"name": "edX",
"description": "Flexible learning on your schedule. Access more than 1900 online courses from 100+ leading institutions including Harvard, MIT, Microsoft, and more.",
"linkName": "Go to the site",
"linkURL": "https://www.edx.org/"
}
]
We created a simple template with a table that includes a header and a row containing tokens from our JSON structure.
To reference the properties of the objects, we simply used their names:
{{name}}
, {{description}}
, {{linkURL}}
.
To create a hyperlink, we’ve modified the {{linkURL}}
token by adding the #link
operation as follows:
{{#link linkURL linkName}}
The linkName
property serves as the display name for the hyperlink.
Here’s the final result:
For more details about the #link
operation, click here.
To add an endnote, click where you want it in your template, go to the References tab in the top ribbon, and select Insert Endnote.
Endnotes and footnotes preserve the context of their definitions, enabling the template engine to replace multiple tags that belong to the same context.
Here’s the result: