Referencing a file resource
A file resource can be referenced within presentation templates and other element designs using either a component or element tag.
Create a link to a file resource
To create a link to a file resource in a presentation template or element design to enable users to download the file reference, use the following tag structures.To create a link to a file resource component we use a component tag:
<a href="[component name="FileResourceName"]">Link Text</a>
To create a link to a file resource element we use an element tag. For example, to link to a file resource element in the current content item:
<a href="[element type="content" content="current" key="FileResourceName"]">Link Text</a>
Render a file resource on a page
If the file resource is a file type that can be converted to HTML we can instead convert the file to HTML and render the converted HTML directly in the web content using the format="HTML" parameter in a component or element tag. For example:
[component name="FileResourceName" format="HTML"]
[element type="content" content="current" key="FileResourceName" format="HTML"]
Examples of supported file types include:
- word-processing documents (*.doc, *.odt)
- spreadsheets (*.xls) *
- HTML files (*.htm, *.html)
- Text files (*.txt)
Other file types may also work but we need to test them first.
If we configure an authoring template to be a resource template, then the content items created are resource content items. When a link to a resource content item is rendered, the file stored in the selected file resource element is rendered on the web page. In this case, we would not use an element tag. Instead, the file resource is rendered either using a placeholder tag in a navigator or menu design, or by writing a link directly to the resource content itself.
Parent Use a file resource element