Page 1 of 1

Changing Title Tags

Posted: Tue Jan 06, 2009 10:07 am
by dappy2
I'd like to customize my title tags. I've read the multitude of posts about different ways to bind the meta tags, restructuring the <head> code layout etc. But none of them are quite what I want. (The meta tag rewrite viewtopic.php?f=42&t=9073 also resulted in duplicate title tags for me - which I'm sure will set off all kinds of alarms at Google).

What I want for my title tag is this:
"ProductName | Category Name (deepest level, not all - so whatever subcategory it is in) | StoreName"

This helps to get a few extra keywords in the title, is useful for Google Search Results and doesn't harm your ranking because it isn't gaming the system, it is letting people know where they are in the site etc.

Even for catalog pages it should be "CategoryName | StoreName"

Is this possible? I see in Product3.aspx where it is setting the title:

Code: Select all

    protected void Page_Load(object sender, EventArgs e)
    {
        if (_Product != null)
        {
            if (!Page.IsPostBack)
                //REGISTER THE PAGEVIEW
                CommerceBuilder.Services.AbleCommerceHttpModule.RegisterCatalogNode(_Product.ProductId, CatalogNodeType.Product);
            PageHelper.BindMetaTags(this, _Product);
            Page.Title = _Product.Name;
        }
    }
But I have no idea about how to add the rest of the text to those strings or even how to properly reference the category.

Thanks,
Dappy

Re: Changing Title Tags

Posted: Tue Jan 06, 2009 10:21 am
by mazhar
You can put title as per your requirement as below

Code: Select all

protected void Page_Load(Object sender, EventArgs e)
    {     
        Page.Title = "Your custom title here"
    }

Re: Changing Title Tags

Posted: Tue Jan 06, 2009 10:24 am
by dappy2
The page titles should be dynamic however for the product (Product3.aspx is what I'm using) and the Catalog Pages. I've already set the title tags for everything that isn't a dynamic page.

Dappy

Re: Changing Title Tags

Posted: Tue Jan 06, 2009 12:45 pm
by jmestep
I have taken the title section out of the- for example- Catalogx.aspx page and put code in the ConLib/Custom/Catalogx.ascx.cs to create custom titles.
A simple sample would be:

Code: Select all

protected void Page_PreRender(object sender, EventArgs e)
    {
       
       Page.Title = _Category.Name + " whatever you want here";
  
    }
You can see a sample of something more complex at
http://www.uptownenterprises.com/Multi- ... s-C15.aspx

Sorry, I can't give the code out- he paid to have it programmed.

Re: Changing Title Tags

Posted: Tue Jan 06, 2009 1:03 pm
by dappy2
Thanks -

Yeah I just kinda figured it out. It is just confusing to when certain pages set things on the page and other use the code behind. So I ended up running around in circles.

Dappy