close

Filter

loading table of contents...

Frontend Developer Manual / Version 2110

Table Of Contents

6.5.2 Preview (preview)

The preview FreeMarker API provides calls to render inline metadata information about content, prints out additional script sources for a CAE preview in Studio and supports specific Boolean calls. It uses the namespace preview for template calls.

preview.metadata

Provides inline metadata information to be used for the CAE. This metadata is used by Studio. For more information see Section 4.3.5, “Adding Document Metadata” in Content Application Developer Manual.

Parameter Required Description
data Prints serialized metadata.

Table 6.28. Parameter of metadata


<div<@preview.metadata self.content/>>
  <h1<@preview.metadata "properties.title"/>>${self.title}</h1>
  <div<@preview.metadata "properties.text"/>>${self.text}</div>
</div>

Example 6.20. Getting Metadata for a container with title and text.


preview.previewScripts

Prints all scripts and styles necessary for handling the preview.metadata by CAE to Studio. Should be added in the HTML head.

<@preview.previewScripts/>

preview.isPreviewCae()

Returns true if CAE is running as Preview CAE.

<#if preview.isPreviewCae()>...</#if>

preview.isFragmentPreview()

Returns true if CAE is rendering a fragmented preview of a content.

<#if preview.isFragmentPreview()>...</#if>

preview.getStudioAdditionalFilesMetadata(cssList, jsList)

Returns optional serialized metadata files in the header in order to render additional Studio specific CSS and JS in the preview frame. For more information see Section 4.3.5, “Adding Document Metadata” in Content Application Developer Manual.

Parameter Required Description
cssList Gets CSS sources for the Studio preview.
jsList Gets JavaScript sources for the Studio preview.

Table 6.29. Parameters of getStudioAdditionalFilesMetadata


<#assign studioExtraFiles=preview.getStudioAdditionalFilesMetadata(
    bp.setting(self, "studioPreviewCss"),
    bp.setting(self, "studioPreviewJs")
)/>

<head<@preview.metadata data=studioExtraFiles/>>
  ...
</head>

Example 6.21. Include CSS and JavaScript from content settings with the names "studioPreviewCss" and studioPreviewJs".


preview.content

Function to get the content information of a given object that can be used to render preview information. If no content information was found, cm.UNDEFINED is returned (see Section 6.5.1, “CoreMedia (cm)”).

<@preview.metadata data=[preview.content(self)] />

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.