xpagesxpages-ssjsxpages-extlib

How to set the pageTitle property for all pages that use a custom control?


Would like to automatically compute the pageTitle property on the XPage to simply show the XPage name. I want to code this once on the Application Layout custom control so every page where I add the control gets the benefit of the property calculation. So far, I have some SSJS on my CC to calculate the page title and assign to a viewScope variable:

var path:String = context.getUrl().getPath();
var xpageName:String = @RightBack(path,"/");
viewScope.xpageName = xpageName;
return xpageName

On any XPage where I add the CC I can simply return the value of the viewScope variable to the pageTitle property like this:

viewScope.xpageName

However, was wondering how to automatically set it from the CC without the need for the line above. Can this be done?


Solution

  • You can also set the pageTitle in a theme. This page from Julian Buss's site shows code for defaulting the value http://xpageswiki.com/web/youatnotes/wiki-xpages.nsf/dx/Work_with_themes. Because override is set to false, you can override it on any custom control or XPage you choose. This is one of the theme properties I set in all applications.