Enabling SEO title and meta description information for migration
When migrating an existing store to use the search engine optimization feature,
the title and meta description data for your store pages needs to be
populated.
Before you begin
Procedure
-
Load the title and meta description (TMD) templates for your store pages.
-
For each store, issue the following SQL statements. These statements add
new page types to the table so that can identify
which title and meta description template can be used for specific pages:
Where:insert into seopagedef (seopagedef_id, pagename, storeent_id, lastupdate, createdtime) values (100, 'HOME_PAGE', 12201, '2010-01-01 00:00:00.00', '2010-01-01 00:00:00.00'); insert into seopagedef (seopagedef_id, pagename, storeent_id, lastupdate, createdtime) values (101, 'HELP_PAGE', 12201, '2010-01-01 00:00:00.00', '2010-01-01 00:00:00.00'); insert into seopagedef (seopagedef_id, pagename, storeent_id, lastupdate, createdtime) values (102, 'PRIVACY_PAGE', 12201, '2010-01-01 00:00:00.00', '2010-01-01 00:00:00.00'); insert into seopagedef (seopagedef_id, pagename, storeent_id, lastupdate, createdtime) values (103, 'SITEMAP_PAGE', 12201, '2010-01-01 00:00:00.00', '2010-01-01 00:00:00.00'); insert into seopagedef (seopagedef_id, pagename, storeent_id, lastupdate, createdtime) values (104, 'CATEGORY_PAGE', 12201, '2010-01-01 00:00:00.00', '2010-01-01 00:00:00.00'); insert into seopagedef (seopagedef_id, pagename, storeent_id, lastupdate, createdtime) values (105, 'PRODUCT_PAGE', 12201, '2010-01-01 00:00:00.00', '2010-01-01 00:00:00.00'); insert into seopagedefovr (seopagedefovr_id, seopagedef_id, objecttype, object_id, apply_to_child) values (200, 104, 'CatalogGroup', '0', 1); insert into seopagedefovr (seopagedefovr_id, seopagedef_id, objecttype, object_id, apply_to_child) values (201, 105, 'CatalogEntry', '0', 1);
- seopagedef_id is any number not already in the table, and references the table for the actual template
- pagename is the type of store page. For example, HELP_PAGE, PRIVACY_PAGE, SITEMAP PAGE, CATEGORY PAGE, and PRODUCT_PAGE.
- lastupdate and createdtime is any time stamp
-
For each language your store uses, issue the following SQL statements to insert the title and
meta description templates into the table. The templates store how
the title and meta description is to be constructed for the various page types (for example
Product, Category, and Contact us
pages) in your store.
Where:insert into seopagedefdesc (seopagedef_id, language_id, title, meta_desc, meta_keyword, image_alt_desc, lastupdate, createdtime) values (100, -1, 'Welcome to <seo: StoreName/>', 'Shop <seo: StoreName/> online.<seo: StoreDescription/>', '<seo: StoreName/> <seo: StoreDescription/>', 'Image for <seo: StoreName/> homepage', '2010-01-01 00:00:00.00', '2010-01-01 00:00:00.00'); insert into seopagedefdesc (seopagedef_id, language_id, title, meta_desc, meta_keyword, image_alt_desc, lastupdate, createdtime) values (101, -1, 'Help and Contact Us at <seo: StoreName/>', 'Help Contact Us <seo: StoreName/>', 'Help Contact Us <seo: StoreName/>', 'Image for <seo: StoreName/> Help and Contact Us', '2010-01-01 00:00:00.00', '2010-01-01 00:00:00.00'); insert into seopagedefdesc (seopagedef_id, language_id, title, meta_desc, meta_keyword, image_alt_desc, lastupdate, createdtime) values (102, -1, 'Website Privacy Policy for <seo: StoreName/>', 'Website Privacy Policy for <seo: StoreName/>', 'Website Privacy Policy <seo: StoreName/>', 'Image for <seo: StoreName/> Site Map', '2010-01-01 00:00:00.00', '2010-01-01 00:00:00.00'); insert into seopagedefdesc (seopagedef_id, language_id, title, meta_desc, meta_keyword, image_alt_desc, lastupdate, createdtime) values (103, -1, 'Site Map for <seo: StoreName/>', 'Site Map for <seo: StoreName/>', 'ite Map <seo: StoreName/>', 'Image for <seo: StoreName/> Site Map', '2010-01-01 00:00:00.00', '2010-01-01 00:00:00.00'); insert into seopagedefdesc (seopagedef_id, language_id, title, meta_desc, meta_keyword, image_alt_desc, lastupdate, createdtime) values (104, -1, '<seo: CategoryName/> | <seo: StoreName/>', '<seo: CategoryShortDescription/>', '<seo: CategoryKeyword/>', 'Image for <seo: CategoryName/> from <seo: StoreName/>', '2010-01-01 00:00:00.00', '2010-01-01 00:00:00.00'); insert into seopagedefdesc (seopagedef_id, language_id, title, meta_desc, meta_keyword, image_alt_desc, lastupdate, createdtime) values (105, -1, '<seo: ProductName/> | <seo: StoreName/>', '<seo: ProductShortDescription/>', '<seo: ProductKeyword/> <seo: ProductManufacturerName/>', 'Image for <seo: ProductName/> from <seo: StoreName/>', '2010-01-01 00:00:00.00', '2010-01-01 00:00:00.00');
- seopagedef_id references the page definition that is defined in table
- language_id is the language of the store the SQL is creating templates for
- title, meta_desc, meta_keyword, image_alt_desc, are the default title and meta description templates. These templates can be changed freely
Note: Substitution parameters in the templates such as, <seo: StoreName/> represent the store name that is to be replaced when the template is retrieved. For more information, see Substitution parameters for Search Engine Optimization (SEO)
-
For each store, issue the following SQL statements. These statements add
new page types to the table so that can identify
which title and meta description template can be used for specific pages:
-
Modify your static page JSPs (such as Home, Help, and
Privacy) to use the title and meta description data.
-
Service call:
<wcf:getData type="com.ibm.commerce.infrastructure.facade.datatypes.OnlineStoreType" var="onlineStoreSEO" expressionBuilder="findSEOPageDefintionByPageNameAndStoreID"> <wcf:contextData name="storeId" data="${WCParam.storeId}"/> <wcf:param name="storeId" value="${WCParam.storeId}"/> <wcf:param name="dataLanguageIds" value="${WCParam.langId}"/> <wcf:param name="pageName" value="HOME_PAGE"/> <wcf:param name="accessProfile" value="IBM_Store_SEOPageDefinition_Details"/> </wcf:getData>
Note: The pageName references the pagename column in the table. Specify the pagename that is needed for the specific JSP. -
Displaying the data:
<title><c:out value="${onlineStoreSEO.SEOPageDefinitions[0].title}"/></title> <meta name="description" content="<c:out value="${onlineStoreSEO.SEOPageDefinitions[0].metaDescription}"/>"/> <meta name="keyword" content="<c:out value="${onlineStoreSEO.SEOPageDefinitions[0].metaKeyword}"/>"/>
-
Service call:
-
Modify your category JSP to use the title and meta description data:
-
Service call:
<wcf:getData type="com.ibm.commerce.catalog.facade.datatypes.CatalogNavigationViewType" var="catGroupDetailsView" expressionBuilder="getCatalogNavigationCatalogGroupView"> <wcf:param name="UniqueID" value="${catUniqueId}"/> <wcf:contextData name="storeId" data="${WCParam.storeId}" /> <wcf:contextData name="catalogId" data="${WCParam.catalogId}" /> <wcf:param name="searchProfile" value="IBM_findCatalogGroupDetails"/> </wcf:getData>
-
Displaying the data:
<title><c:out value="${catGroupDetailsView.catalogGroupView[0].title}"/></title> <meta name="description" content="<c:out value="${catGroupDetailsView.catalogGroupView[0].metaDescription}"/>"/> <c:set var="fullImageAltDescription" value="${catGroupDetailsView.catalogGroupView[0].fullImageAltDescription}" scope="request" />
-
Service call:
-
Modify your product JSP to use the title and meta description data:
-
Service call:
<wcf:getData type="com.ibm.commerce.catalog.facade.datatypes.CatalogNavigationViewType" var="catalogNavigationView" expressionBuilder="getCatalogNavigationCatalogEntryView"> <wcf:param name="UniqueID" value="${productId}"/> <wcf:param name="searchProfile" value="IBM_findCatalogEntrySummary"/> <wcf:contextData name="storeId" data="${WCParam.storeId}" /> <wcf:contextData name="catalogId" data="${WCParam.catalogId}" /> </wcf:getData>
-
Displaying the data:
<title><c:out value="${catalogNavigationView.catalogEntryView[0].title}"/></title> <meta name="description" content="<c:out value="${catalogNavigationView.catalogEntryView[0].metaDescription}"/>"/> <c:set var="fullImageAltDescription" value="${catalogNavigationView.catalogEntryView[0].fullImageAltDescription}" scope="request" />
-
Service call:
-
Modify the get-data-config.xml file to include the necessary expression
builders.
- Navigate to the /Stores/WebContent/WEB-INF/config/com.ibm.commerce.catalog-fep directory.
- Open the get-data-config.xml file.
-
Before the ending
<wcf:get-data-config>
tag, paste the following code:<expression-builder> <name>getCatalogNavigationCatalogGroupView</name> <data-type-name>CatalogNavigationView</data-type-name> <class>com.ibm.commerce.foundation.internal.client.taglib.util.UniqueIDs ExpressionBuilder</class> <method>formatExpression</method> <param> <name>template</name> <value>/CatalogNavigationView[CatalogGroupView[(UniqueID=)]]</value> </param> <param> <name>accessProfile</name> <value>IBM_Store_Summary</value> </param> <param> <name>searchProfile</name> <value>IBM_findCatalogGroupSummary</value> </param> </expression-builder> <expression-builder> <name>getCatalogNavigationCatalogEntryView</name> <data-type-name>CatalogNavigationView</data-type-name> <class>com.ibm.commerce.foundation.internal.client.taglib.util.UniqueIDs ExpressionBuilder</class> <method>formatExpression</method> <param> <name>template</name> <value>/CatalogNavigationView[CatalogEntryView[(UniqueID=)]]</value> </param> <param> <name>accessProfile</name> <value>IBM_Store_CatalogEntrySearch</value> </param> <param> <name>searchProfile</name> <value>IBM_findCatalogEntrySummary</value> </param> </expression-builder>