SEO tips for WebCenter Content Presenter

Introduction

When building a public facing website, it is important that search engines like Google and Bing can understand the content on your page. This will allow those engines to properly index your site which will result in better rankings and traffic.

WebCenter Portal provides several techniques to deliver content in dynamic way which can be changed by business owners and contributors. One of the key components is the Content Presenter which displays content from a content server.
In order for your page to reflect the metadata from the content in the content presenter, some customization need to be done on the content presenter so that search engines can read the metadata.

Main Article

Search engines not only analyse the content on a page, they also can read the meta tags inside the HEAD tag of a page which describes the content of the page.
Due to the dynamic property of a WebCenter Portal page, its’s hard to provide meaningful values for those tags unless you know what content the users put on the page. Therefore we can dynamically assign values to the meta tags.

Within ADF this is done using the metaContainer facet from the document. Within that facet you can add meta tags and bind their value to managed beans like below:

<af:document id="d1" title="#{portalResource['home_title']}">
    <f:facet name="metaContainer">
        <af:group id="g1">
          <trh:meta id="m1" name="keywords" content="#{metaBean.meta}"/>
          <trh:meta id="m2" name="description" content="#{metaBean.description}"/>
        </af:group>
      </f:facet>
</af:document>

Using this, you can drive the meta tags from anywhere in the portal but because the content presenter is one of the key components that delivers content to the portal, it makes sense to let the content presenter set the correct values for the keywords and description tags.

In order to do so we need to customize the content presenter.
We need to add a method call just before the content presenter will display the content.

The content presenter has two ways for displaying the content. One if for multiple items which is called by the presenter-multi-node-view page. The other one is for a single item which is called by the presenter-single-node-view page.

The customization involves adding a method call just before one of the view pages:

Customizing content presenter

Activity properties

That custom call will retrieve the content items configured for the content presenter and set the keyword and description tag accordingly.
Because we are inside the content presenter, we can easily retrieve the items by using some expression language:

#{backingBeanScope.presenterBacking.results}

This will return a SortableModel which contains a collection of Node items. Each Node represents an item that the content presenter will render.
By looping this we can compose the keywords list:

    public String getNode() throws Exception{
        Object o = JSFUtils.resolveExpression("#{backingBeanScope.presenterBacking.results}");
        if(o != null){
            SortableModel model = (SortableModel)o;
            String tags = "";
            if(model.getRowCount() >0){
                for(int i =0;i<model.getRowCount();i++){
                    Object n = model.getRowData(i);
                    Node node = (Node)n;
                    tags = tags + " " + node.getProperty("xWCTags").getValue().getStringValue();
                }
            }
            this.meta = tags;
        }
        return "";
    }

The Node object we get in this loop is the same Node object as you would when using a node in a content presenter template. This means you have access to all the metadata of the content item so you can easily propagate this to the meta tags on the page.

Add Your Comment