Hi All
I am working on a couple of stores for customers and I have made the following code level mods. I hope you like them and that they are deemed useful enough to be absorbed into the main codebase?
All changes are in catalog.ascx.cs:
To make your category pages appear unique to a search engine:
in private ArrayList GetCategoryProducts(int categoryID, ArrayList products) add the following immediately before "return products;".
//Added by Stu - Add Model Name and Number to page title, if available
DotNetNuke.Framework.CDefault p = (DotNetNuke.Framework.CDefault)Page;
//Set dynamic page title
if (!string.IsNullOrEmpty(category.CategoryName))
{
p.Title += category.CategoryName;
p.KeyWords = category.CategoryName;
}
//Set dynamic Meta Keywords
if (!string.IsNullOrEmpty(category.CategoryDescription))
{
if (p.KeyWords.Length > 0) p.KeyWords += " ";
p.KeyWords += category.CategoryDescription;
}
//Set dynamic Meta Description
if (!string.IsNullOrEmpty(category.CategoryDescription))
{
p.Description = category.CategoryDescription;
}
//End added by Stu
To make your individual product pages appear unique to a search engine:
in private Control loadProductDetail() add the following immediately before "return productDetail;".
//Added by Stu - Add Model Name and Number to page title, if available
DotNetNuke.Framework.CDefault p = (DotNetNuke.Framework.CDefault)Page;
//Set dynamic page title
if (!string.IsNullOrEmpty(productInfo.ModelName))
{
p.Title = productInfo.ModelName;
if (!string.IsNullOrEmpty(productInfo.ModelNumber))
{
p.Title += ", " + productInfo.ModelNumber;
}
}
else
{
if (!string.IsNullOrEmpty(productInfo.ModelNumber))
{
p.Title = cpTitle + " > " + productInfo.ModelNumber;
}
}
//Set dynamic Meta Keywords
if (!string.IsNullOrEmpty(productInfo.Summary))
{
p.KeyWords = productInfo.Summary;
}
//Set dynamic Meta Description
if (!string.IsNullOrEmpty(productInfo.Description))
{
p.Description = productInfo.Description;
}
//End added by Stu
I am not sure whether it is possible to have two catalog modules on one page. If so, obviously one module would over-write the meta tags set by the other. Also adding any other modules that effect the page title or meta tags could possible over-write the values set here. But I don't see a way around those two problems or that they are likely to occur very often??
Thanks for your time.
Stuart