Introduction
One of the most important purposes of building a commercial accessible site is to get visitors to access it, there is many strategies to do so. One of the most common strategy is to make sure its found when people are browsing through search results on the major search engines. Search engines today expects to find meta tags in the header of each page, by using this meta tags the site is categorized. Example of categorization you can do is for instance language of the page, title and description.
This post will demonstrate one way of controlling this meta tags in run-time for each page.
Main Article
As you probably already know a WebCenter Portal Page delivery consist of a Page Template and the a Portal Page instance that can be created at design-time or run-time. The best practice to add header parameters, also known as Meta tags is to use the enabled ADF pattern on the Portal Page Instance. This means: Design-Time you do below steps directly on the page, and Run-Time you do below steps in the Page Style, a page style is used to create a page instance in run-time.
<af:document id="d1" title="Home"> <f:facet name="metaContainer"> </f:facet>
<af:group id="g1"> <meta name="TITLE" content="${navigationContext.currentNavigationModel.currentSelection.title}"/> <meta name="DESCRIPTION" content="${navigationContext.currentNavigationModel.currentSelection.parameters['Description']}"/> <meta name="KEYWORDS" content="${navigationContext.currentNavigationModel.currentSelection.parameters['Keywords']}"/> <meta name="ROBOTS" content="${navigationContext.currentNavigationModel.currentSelection.parameters['Robots']}"/> <meta name="LANGUAGE" content="${navigationContext.currentNavigationModel.currentSelection.parameters['Language']}"/> <meta name="RIGHTS" content="${navigationContext.currentNavigationModel.currentSelection.parameters['Rights']}"/> </af:group>
The last step now is to enable meta editing in run-time for each page, there are two approaches to this. One is to edit the values on the page properties, or alternatively, edit them directly in the navigation model. Above example assumes the editing of the parameters is done in the navigation model.
To enable the parameters available for editing is implemented in one way for both use cases. On the page or page style add the parameters to the page properties:
${navigationContext.currentNavigationModel.currentSelection.parameters['Language']
The same name on the parameter as the EL is using when resolving them.
If you prefer to edit the meta values on the page instead use following EL instead when resolving the values:
${bindings.Language}
Run-time editing of meta values in the navigation model
Page rendering result - using Firebug to debug page markup and header section