Search Engine Optimization (SEO)

Today in this post i would like to present the SEO concept in WCS, with some sample coding also which must be helpful in implementing using the steps provided in this post, so let’s get into the steps for this SEO task :

here are the steps that need to follow for implementing the SEO for the WCS e-Commerce site,

  1. First of all we need to Enable the SEOURLMapper in instance config file (i.e. ec-server.xml)

Note : this SEOURLMapper is already enabled in V7. so you need to just check the below mentioned code whether the SEOURLMapper is enabled or not.

<component compClassName="com.ibm.commerce.datatype.UrlMapperConfig"
                    enable="true" name="UrlMapperConfig">
<property UrlMapperFile="mapper/SEOUrlMapper.xml" display="false"/>
</component>

2. Identify the page, which we want to optimize

Eg: lets check optimizing the below mentioned example URL

http://localhost/webapp/wcs/stores/servlet/TopCategoriesDisplay?langId=-&storeId=10101&catalogId=10201

to

http://localhost/webapp/wcs/stores/servlet/TopCategories_-1_10101_10201

3. Now in this step we need to give an entry in the SEOUrlMapper.xml, for this let’s follow the below given sample code,

<pathInfo_mapping name="TopCategories" requestName="TopCategoriesDisplay" >
<parameter name="langId" />
<parameter name="storeId" />
<parameter name="catalogId" />
</pathInfo_mapping>

Note : in WCS V7 the SEOUrlMapper.xml has the above mentioned code already so you can verify the sample and if you are working on V6 then we need to update the code by giving the entries in the relevant files to compile the SEO, and also we can add a new entry for a new URL for practice purpose.

4. Now we need to locate the below mentioned code in the LanguageSelectionForm.jsp

<c:url var="TopCategoriesDisplayURL" value="TopCategoriesDisplay"> <c:param name="langId" value="${dbLanguage.languageId}" /> <c:param name="storeId" value="${WCParam.storeId}" /> <c:param name="catalogId" value="${WCParam.catalogId}" /> </c:url>

we need to replace the above code to the code which we are pointing at the below section

<wcf:url var="TopCategoriesDisplayURL" value="TopCategories"> <wcf:param name="langId" value="${dbLanguage.languageId}" /> <wcf:param name="catalogId" value="${WCParam.catalogId}"/> <wcf:param name="storeId" value="${WCParam.storeId}"/> </wcf:url>

Here if you observe we are change the tags(i.e. c:url to wcf:url & c:param to wcf:param this concept we will discuss in the following posts on the site)

5. Now we need to include a tab library in the LanguageSelectionForm.jsp mentioned below,

<%@ taglib uri="http://commerce.ibm.com/foundation" prefix="wcf" %>

Here if you observe the included taglib link which will be helpful to use the wcf tag class which will be helping us to build a URL and applies the appropriate Websphere Commerce supported rewriting rules.

It contains the following additions compared to the c:url tag

  • it builds a full path URL. rather than a relative path.
  • it also helps to build the SEO compliant URLs if the feature is used in webSphere Commerce.
  • It adds a prefix to the URL with the appropriate protocol, HTTP or HTTPS, depending on the Struts Configuration files.

6. Now we reached to end of the task wherein we need to save all the coded files and now we need to restart the server to test the task. so once you restart the server then select he index.jsp and run on server, then we need to select the language section in the index homepage as we are pointing this task by doing the SEO for the LanguageSelectionForm.jsp file. Now observe the magic of URL framed which will be short URL and this form of URLs are much helpful in search engine to make the URLs crawl in a better way.

SEO sample

Consumer Direct store Eg

Here we tried the task on the Consumer Direct store that’s the reason we used the languageselectionform.jsp. You can try the same steps for a newly implemented .jsp like giving the entries provided in the above steps and check the implementation. Do let us know if anything we need to concentrate on in this site so that we can discuss that concept in depth.

3 Comments

  1. Romana Shaddix August 21, 2016
    • WCSBasics August 21, 2016
  2. Brian Tozer November 3, 2016

Leave a Reply