Making your SAP Portal indexable by search engines
Quite often SAP Enterprise Portal is used by a company to build up its own intranet portal: in this case the developers doesn’t have to deal with public search engines (Google, Bing and so on) because the portal is reachable only inside the corporate intranet.
But if you build up a public internet portal you have to take care of these topics if you want the users find the site over the whole internet.
By standard SAP Enterprise Portal doesn’t support search engines user agents: if you try to access your portal installation simulating a search engine bot (googlebot or bingbot) the following message appears:
To simulate the search engine bot you can use the powerful User Agent Switcher Chrome extension (link) that is able to simulate the most common user agents string (mobile browsers too).
The extension is available also for Mozilla browser (link).
If you choose for example google bot and try to open your portal you’ll get the error above.
The reason of this error message can be found in the “Supported User Agent” property of the portal objects: if you open a pcd object (iview, page, layout and so on) you’ll find this property filled with one of the following values.
As you can see there is no entry for the search engine user agents and this is why our portal can’t be displayed by Google.
To solve the issue SAP released a note that explains the solution: you have to add the user agent string you need to support into this property. The note suggests to make a mass property find and replace on the pcd objects to put the desired value for the supported user agent property: if you put (*,*,*) the object will support any user agent string passed in the request.
That’s it, problem solved! If you open the object after the find and replace you’ll see the new property value.
It’s so easy, do we need another boring and useless blog post on this?
Perhaps it’s not so easy as the note says.
Suppose you need to change another property on the portal object: for some reason you need to change the iview height or the show tray property; once you opened your object, changed and saved it, you can notice your supported user agent custom value gets lost.
This happens because the (*,*,*) value isn’t available in the list of the possible values for the property then, if you open the object in change mode, the value isn’t recognized and is replaced by one of the valid values. So bad!
To make it work properly you need to extend the SAP proposed solution adding the new value to the dropdown list.
You can do it working on the metadata of the property with the PCD Inspector Tool (here you can find the PCD documentation on sap help site).
The easiest way is to modify the metadata in the core objects so the changes are inherited in all the derived objects.
You can find the core objects in the following pcd path: portal_content/com.sap.pct/default_objects
It should be enough to change the metadata values in iview, layout and page objects.
To change the metadata open the propEditor for the selected object (e.g. iView), select supportedUserAgent property and select viewMeta menu
A new window will open with all the property metadata , scroll down to the bottom and find the SupportedUserAgents-validvalues property:
Click edit and change the property adding the required user agent string. To enable all the possibile user agent you have to insert (*,*,*) value.
According to the field policy you have to add the prefix 7/ where 7 is the length of the string, then the complete new value for the property will be:
47/(MSIE, >=5.5, *) (Netscape, *, *) (Mozilla,*,*)79/(MSIE, >=5.5, *) (Netscape, *, *) (Mozilla,*,*) (Safari, >=3.1, *) (Chrome,*,*)16/(MSIE, >=5.5, *)30/(Netscape, *, *) (Mozilla,*,*)18/(Safari, >=3.1, *)7/(*,*,*)
Save and make the same changes to all the pcd objects you need, then try again to enter you portal as a search engine bot: it will work now!
Following this steps makes your portal indexable by search engines and, compared to the sap note standard solution, you won’t have to worry if you make subsequent changes to the portal objects.
On the other side this is isn’t a perfect solution because it makes changes on sap delivered objects: if a portal patching or upgrade occurs and the supporteduseragent property metadata is affected the changes would be ovewritten so you have to remind to apply again these changes.
I wanted to share my solution because I didn’t find any reference on this topic not even in the forums: I hope this will be helpful for the ones will face this issue during development.
Feel free to comment or suggest any improvement or alternative solution if you know!