Changing Title Tags

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
dappy2
Commander (CMDR)
Commander (CMDR)
Posts: 114
Joined: Wed Jan 18, 2006 5:53 pm
Contact:

Changing Title Tags

Post by dappy2 » Tue Jan 06, 2009 10:07 am

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

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Changing Title Tags

Post by mazhar » Tue Jan 06, 2009 10:21 am

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"
    }

dappy2
Commander (CMDR)
Commander (CMDR)
Posts: 114
Joined: Wed Jan 18, 2006 5:53 pm
Contact:

Re: Changing Title Tags

Post by dappy2 » Tue Jan 06, 2009 10:24 am

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

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Changing Title Tags

Post by jmestep » Tue Jan 06, 2009 12:45 pm

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.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

dappy2
Commander (CMDR)
Commander (CMDR)
Posts: 114
Joined: Wed Jan 18, 2006 5:53 pm
Contact:

Re: Changing Title Tags

Post by dappy2 » Tue Jan 06, 2009 1:03 pm

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

Post Reply