I know that you can change the page title at the portal level, but this solution doesn't offer any SEO value since it doesn't change the TITLE tag in the page.
For what I've seen the way to changing the portal titles are very static (these are global settings):
- Changing the bannerTitleText in the theme policy
- If that's not present adjust the bannerTitleTextResourceBundle and bannerTitleTextResourceKey to the desired value.
- Otherwise, set the titles globally at the theme configuration
Our goal is to be able to set the title at the page level so that it can change from page to page and include the relevant page's keyword.
Actually it would be most ideal if this could be done from WCM.
Update
I noticed that the default theme in WebSphere Portal 6.1.5 was appending the page title, so examined the theme and surely enough the jspInit.jspf had some the following new methods:
private static com.ibm.portal.state.service.PortalStateManagerServiceHome portalStateManagerServiceHome;
// (This goes in the jspInit constructor)
portalStateManagerServiceHome = (com.ibm.portal.state.service.PortalStateManagerServiceHome) ctx.lookup("portal:service/state/PortalStateManager");
protected com.ibm.portal.state.service.PortalStateManagerService getStateManagerService( javax.servlet.ServletRequest request, javax.servlet.ServletResponse response ) throws Exception {
final com.ibm.portal.state.service.PortalStateManagerService psms = portalStateManagerServiceHome.getPortalStateManagerService( (javax.servlet.http.HttpServletRequest) request, (javax.servlet.http.HttpServletResponse) response );
return psms;
}
protected boolean isStaticPage( javax.servlet.ServletRequest request, javax.servlet.ServletResponse response ) throws com.ibm.portal.ModelException {
final com.ibm.portal.model.NavigationSelectionModelProvider nsmProvider = navigationSelectionModelHome.getNavigationSelectionModelProvider();
final com.ibm.portal.navigation.NavigationSelectionModel nsm = nsmProvider.getNavigationSelectionModel(request, response);
final com.ibm.portal.navigation.NavigationNode currentNavNode = (com.ibm.portal.navigation.NavigationNode) nsm.getSelectedNode();
final com.ibm.portal.content.ContentNode currentContentNode = currentNavNode.getContentNode();
return currentContentNode.getContentNodeType().equals( com.ibm.portal.content.ContentNodeType.STATICPAGE );
}
protected com.ibm.portal.navigation.NavigationNode getSelectedNode( final javax.servlet.ServletRequest request, javax.servlet.ServletResponse response ) throws com.ibm.portal.ModelException {
com.ibm.portal.model.NavigationSelectionModelProvider nsmProvider = navigationSelectionModelHome.getNavigationSelectionModelProvider();
com.ibm.portal.navigation.NavigationSelectionModel nsm = nsmProvider.getNavigationSelectionModel(request, response);
return (com.ibm.portal.navigation.NavigationNode) nsm.getSelectedNode();
}
protected String getSelectedNodeTitle( final javax.servlet.ServletRequest request, javax.servlet.ServletResponse response ) throws com.ibm.portal.ModelException {
final String title;
if ( localizedContextHome != null ) {
com.ibm.portal.model.LocalizedContext context = localizedContextHome.getLocalizedContext( (javax.servlet.http.HttpServletRequest) request );
title = context.getTitle( getSelectedNode( request, response ) );
} else {
title = "";
}
return title;
}
After adding this I was able to copy the head_title.jspf from the 6.1.5 theme; which includes the following new lines:
<c:set var="selectedNodeTitle" value="<%=getSelectedNodeTitle(request, response)%>" />
<title><c:out value="${siteTitle} - ${selectedNodeTitle}"/></title>
Now all that's left is figuring out a way of fetching this from WCM.
Is there a way to dynamically change the pages title at runtime?