Welcome to the IBM Websphere Commerce Hub


Welcome to the IBM Websphere Commerce Hub

Come join me in my journey to explore the various features and capabilities of IBM Websphere Commerce and understand how retailers can benefit from its really cool out-of-box functionality.

Monday, April 16, 2012

Day 4 : Demo - Creating short SEO URLs for new static views

Let us revisit and do some practical based on the concepts learned on Day 1 to Day 3.

In this demo tuturial , we will create a short SEO friendly URL for a custom view that we have created "SuggestionsComplaintsView" using the WCS 7 SEO Pattern mapping files in simple 3 steps.

We will change the long WCS URL
http://localhost/webapp/wcs/stores/servlet/SuggestionsComplaintsView?storeId=10051&catalogId=10051&langId=-1
to
Short Search Engine optimized URL
http://localhost/webapp/wcs/stores/servlet/en/madisons/suggestion-complaints

Pack up your energy drinks and lets sprint into the SEO world. I hope you will find it in useful.

Demo Video:


Help Section:

The JSPs and XMLs used in this demo can be downloaded from this link.

Pattern Definition made in the SEOURLPatterns-ext.xml

<seourl:seoUrlConfiguration
    xmlns:seourl="http://www.ibm.com/xmlns/prod/commerce/foundation/SEO/URLPattern"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/
SEO/URLPattern wc-seo-url-pattern.xsd">
    <!--
        SuggestionComplaints URL like this:
http://localhost/webapp/wcs/stores/servlet/en/madisons/suggestion-complaints    -->
    <seourl:seoUrlPatternDef name="SuggestionComplaintsURL">
        <seourl:seoUrlPattern viewName="SuggestionsComplaintsView">/LanguageToken/StoreToken:CatalogToken/SuggestionComplaintsToken</seourl:seoUrlPattern>
        <seourl:urlToParamMapping>
            <seourl:mapping name="langId" value="?LanguageToken?" />
            <seourl:mapping name="storeId" value="?StoreToken?" />
            <seourl:mapping name="catalogId" value="?CatalogToken?" />
        </seourl:urlToParamMapping>
        <seourl:paramToUrlMapping>
            <seourl:mapping name="LanguageToken" value="?langId?"
                defaultValue="-1" />
            <seourl:mapping name="StoreToken" value="?storeId?" />
            <seourl:mapping name="CatalogToken" value="?catalogId?" />
            <seourl:mapping name="SuggestionComplaintsToken" value="SuggestionComplaintsToken" />
        </seourl:paramToUrlMapping>
        <seourl:usageDef CMCPrefix="true">
            <seourl:usage device="browser">
                <seourl:target>SuggestionComplaints</seourl:target>
            </seourl:usage>
        </seourl:usageDef>
    </seourl:seoUrlPatternDef>
</seourl:seoUrlConfiguration>

SQL Executed
insert into seotokenusgtype (tokenusgtype_id, tokenusgtype, primarytoken,storeent_id, isstatic) values ((select counter+1 from KEYS where tablename='seotokenusgtype') , 'SuggestionComplaints', 'SuggestionComplaintsToken',<store-id>, 1);
update KEYS set counter=counter+1 where tablename='seotokenusgtype';
insert into seourl (seourl_id, tokenname, tokenvalue) values ((select counter+1 from KEYS where tablename='seourl'), 'SuggestionComplaintsToken', 'SuggestionComplaintsToken');
insert into seourlkeyword (seourlkeyword_id, seourl_id, storeent_id,language_id, urlkeyword, status) values((select counter+1 from KEYS where tablename='seourlkeyword'), (select seourl_id from seourl where tokenname='SuggestionComplaintsToken'), <store-id>, -1, 'suggestion-complaints', 1);
update KEYS set counter=counter+1 where tablename='seourl';
update KEYS set counter=counter+1 where tablename='seourlkeyword';


Related Blogpost
Smarter SEO for Smarter Commerce

3 comments:

  1. good job on a thorough explanation. Very understandable. Thanks

    ReplyDelete
  2. Very thorough and organized explanation. I found it very helpful. Thank you.

    ReplyDelete
  3. This is helpful information, especially with the screenshots. Thanks for sharing.

    ReplyDelete