Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...More SEO friendly Catalog ModuleMore SEO friendly Catalog Module
Previous
 
Next
New Post
3/28/2008 6:45 PM
 

 

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

 

 
New Post
3/29/2008 10:06 AM
 

 

OK.  My test site didn't have any sub categories so I had not spotted that GetCategoryProducts() was recursive!  Sorry!  My updated version of the code to add to GetCategoryProducts() follows:

 

            //Added by Stu - Add Model Name and Number, if available, to page title and meta tags
            if (categoryID == catalogNav.CategoryID)
            {
              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;
              }
              //fetch parent categories
              CategoryInfo ParentCategory = category;
              while (ParentCategory.ParentCategoryID > 0)
              {
                ParentCategory = categoryController.GetCategory(category.ParentCategoryID);
                if (!string.IsNullOrEmpty(ParentCategory.CategoryName))
                {
                  p.Title = ParentCategory.CategoryName + " > " + p.Title;
                  p.KeyWords = ParentCategory.CategoryName + " > " + p.KeyWords;
                }
              }

              //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

Thanks

 

Stuart

 

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...More SEO friendly Catalog ModuleMore SEO friendly Catalog Module


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out