Updating the title of a document

During processing of a page that makes use of frames updating the title of the document can be a useful way of providing feedback to the user about where they are in the application. This is supported through the use of the following client-side template elements in the body of the title element: cst:template, cst:switch (and its direct children), and cst:value.

During processing of a page that makes use of frames updating the title of the document can be a useful way of providing feedback to the user about where they are in the application. This is supported through the use of the following client-side template elements in the body of the title element: cst:template, cst:switch (and its direct children), and cst:value.

The following example shows how to dynamically update the title of a document. If the cst:template's data attribute is bound to a JSON object that has the structure '{isHome: true}', then the title is set to "My Application". If it is bound to a JSON object that has the structure '{subTitle: "Registration"}', then the title is set to "My Application - Registration".

<title>
  <cst:template>My Application
    <cst:switch path="isHome">
      <cst:case boolean="true"/>
      <cst:otherwise> - <cst:value path="subTitle"/></cst:otherwise>
    </cst:switch>
  </cst:template>
</title>

Related topics