DFS 10.4.0 - 10 HTML Templates
HTML Templates is a Dam For Sitecore term. It is used as templates for what HTML should be rendered for different asset types. The reason for this, is that the HTML rendered differs a lot from asset type to asset type - for instance video is very different from image.
The HTML templates are available on the following Sitecore path
/sitecore/system/Modules/Digizuite/MetaDataRoot0/AssetTypeRootOutputRoot
and there is a template available for each asset type. An HTML templates has a HTML section that contains six different fields:
- Rich text Editor Media
- Rich Text Editor Link
- Asset Field Type
- Asset Link Type
- Content Editor Asset
- URL
Each template is used in different scenarios. It should be very apparent which ones for most of them (e.g. Rich Text Editor Media is of course used when inserting media in the Rich Text Editor). The only one that requires a little explaining is the URL one. This one is used when getting the URLs of assets using the API by the methods on the AssetMetadata object.
Understanding the templates
The templates uses the concept of Stampvalues. These are placeholders that are replaced on runtime with the corresponding values.
Info
Rich text editor inserts are resolved at the point in time the asset is inserted in the context language of the insert user.
an example of these templates for the asset type Image looks like this:
<img src="{stampvalue-config:cdn}/{stampvalue-config:mediapipeline}/{stampvalue-asset:assetsiloid}/{stampvalue-asset:assetid}-{stampvalue-selected:quality}" alt="{stampvalue-asset:description}" />
The idea is pretty simple. Each Stampvalue is replaced with corresponding values by a pipeline called GetAssetFieldValue which is defined in the DFS.Settings.config file. It is spawned based on the three custom field types that comes with the DAM For Sitecore module:
- Asset
- AssetList
- AssetLink
Custom HTML Templates
The HTML templates are fully customizeable and may be changed according to client needs. A simple example could be changing the alt text to a different metafield. Furthermore, should there be a need for a more advanced use case, which is not covered by the standard Stampvalues, then the pipeline GetAssetFieldValue can be extended to understand custom Stampvalues.
Info
If the HTML templates are changed, it is very important that the change is also made on the templates on the following path:
/sitecore/templates/Branches/DFS/AssetTypeOutputRoot/AssetTypeOutputRoot
The reason for this, is that the ones under Modules is overwritten by these on synchronization.