Category Page Custom Title
Category Page Custom Title
While our category pages automatically use the name of the cat as the html <title>Title</title>, which is alright, but I wish to change what the Title is, without changing the category name.
Instead of "Category" as the title, I'd like it to show <title>Category at StoreName.com</title>
So I pretty much want to tack on our store's name onto the category name, as the title (for cat pages only.) We have many categories.
How would I do this? I've seen somewhat similar threads, but they didn't exactly address this specific thing, in a way that helps with just this.
Thank you to anyone who helps me with this - This is my first time here, so this would be much appreciated
Instead of "Category" as the title, I'd like it to show <title>Category at StoreName.com</title>
So I pretty much want to tack on our store's name onto the category name, as the title (for cat pages only.) We have many categories.
How would I do this? I've seen somewhat similar threads, but they didn't exactly address this specific thing, in a way that helps with just this.
Thank you to anyone who helps me with this - This is my first time here, so this would be much appreciated
Re: Category Page Custom Title
Welcome!
The file you need to change depends on which category page and which category ConLib control you're using. Here is the code from the CategoryGridPage.ascx.cx file where it sets the page title:
You can change that to:
The other category ConLib controls have the same code. I hope that helps!
The file you need to change depends on which category page and which category ConLib control you're using. Here is the code from the CategoryGridPage.ascx.cx file where it sets the page title:
Code: Select all
private void BindPage()
{
//BIND THE DISPLAY ELEMENTS
if (IsValidCategory())
{
CategoryBreadCrumbs1.Visible = DisplayBreadCrumbs;
CategoryBreadCrumbs1.CategoryId = this.CategoryId;
if (_Category != null)
{
Page.Title = _Category.Name;
Caption.Text = _Category.Name;
}
else
{
// IF IT IS ROOT CATEGORY
Page.Title = DefaultCaption;
Caption.Text = DefaultCaption;
}
Code: Select all
private void BindPage()
{
//BIND THE DISPLAY ELEMENTS
if (IsValidCategory())
{
CategoryBreadCrumbs1.Visible = DisplayBreadCrumbs;
CategoryBreadCrumbs1.CategoryId = this.CategoryId;
if (_Category != null)
{
Page.Title = _Category.Name + " at " + Token.Instance.Store.Name;
Caption.Text = _Category.Name;
}
else
{
// IF IT IS ROOT CATEGORY
Page.Title = DefaultCaption + " at " + Token.Instance.Store.Name;
Caption.Text = DefaultCaption;
}
Re: Category Page Custom Title
Thanks for the help here, david-ebt - I truly appreciate it. Quick reply, too! You rock.
This looks like a perfect solution for what I need done. It must work normally, but it won't on my site. It must be because I have had a plugin enabled at one point, then have since disabled it. This was web 2 market, which I'm not using anymore. Maybe it changed some files in a way that makes the fix you provided not work?
This looks like a perfect solution for what I need done. It must work normally, but it won't on my site. It must be because I have had a plugin enabled at one point, then have since disabled it. This was web 2 market, which I'm not using anymore. Maybe it changed some files in a way that makes the fix you provided not work?
Re: Category Page Custom Title
You're welcome.
It could be the ConLib controls that are active on the site are still custom ConLibs. If you log in as an Admin user, then browse to a category page, then go to the bottom of the page and Edit Page, then click on the notepad icon to the left of the Content drop down, does it show ConLib or ConLib\Custom (or something else) for the location of the ConLib control?
If it is something other than ConLib, then just go into that folder and take a look in the appropriate .cs file for the ConLib control and look in the BindPage function.
It could be the ConLib controls that are active on the site are still custom ConLibs. If you log in as an Admin user, then browse to a category page, then go to the bottom of the page and Edit Page, then click on the notepad icon to the left of the Content drop down, does it show ConLib or ConLib\Custom (or something else) for the location of the ConLib control?
If it is something other than ConLib, then just go into that folder and take a look in the appropriate .cs file for the ConLib control and look in the BindPage function.
Re: Category Page Custom Title
Hey again, sorry for such a late reply - It's been a few hours since I've checked in on this forum.
Thanks very much for continuing to help with this. It blows my mind someone would spend their time helping answer such questions, so this really is cool of you.
This is what I have here - [[ConLib:Custom\CategoryGridPage4 DefaultCaption="Catalog" DisplayBreadCrumbs="false" size="100" PagingLinksLocation="NONE" MaximumSummaryLength="0"]]
Thanks very much for continuing to help with this. It blows my mind someone would spend their time helping answer such questions, so this really is cool of you.
This is what I have here - [[ConLib:Custom\CategoryGridPage4 DefaultCaption="Catalog" DisplayBreadCrumbs="false" size="100" PagingLinksLocation="NONE" MaximumSummaryLength="0"]]
Re: Category Page Custom Title
And this is what I have within the custom CategoryGridPage4 BindPage:
Code: Select all
private void BindPage()
{
CategoryBreadCrumbs1.Visible = DisplayBreadCrumbs;
CategoryBreadCrumbs1.CategoryId = this.CategoryId;
//BIND THE DISPLAY ELEMENTS
if (IsValidCategory())
{
if (_Category != null)
{
Page.Title = _Category.Name + " at " + Token.Instance.Store.Name + ".com";
Caption.Text = _Category.Name;
if (!string.IsNullOrEmpty(_Category.Description))
{
CategoryDescriptionPanel.Visible = true;
CategoryDescription.Text = _Category.Description;
}
else CategoryDescriptionPanel.Visible = false;
// BEGIN MOD: AbleMods.com
// 3/9/2012
// bind meta tags using PageHelper routine
PageHelper.BindMetaTags(this.Page, _Category);
// END MOD: AbleMods.com
}
else
{
// IF IT IS ROOT CATEGORY
Page.Title = DefaultCaption + " at " + Token.Instance.Store.Name;
Caption.Text = DefaultCaption;
CategoryDescriptionPanel.Visible = false;
}
}
else
{
CategoryHeaderPanel.Visible = false;
}
BindSearchResultsPanel();
}
Re: Category Page Custom Title
This looks good. The page title doesn't display as Category Name at Store.com?
Can you post a URL or PM me with one?
Can you post a URL or PM me with one?
Re: Category Page Custom Title
Alright, thanks again - PM sent!
Re: Category Page Custom Title
OK everything is perfect now!
All I had to do was rearrange the code above into the following, so the title would over ride which was over riding the title fix david has shared with me:
All I had to do was rearrange the code above into the following, so the title would over ride
Code: Select all
PageHelper.BindMetaTags(this.Page, _Category);
Code: Select all
private void BindPage()
{
CategoryBreadCrumbs1.Visible = DisplayBreadCrumbs;
CategoryBreadCrumbs1.CategoryId = this.CategoryId;
//BIND THE DISPLAY ELEMENTS
if (IsValidCategory())
{
if (_Category != null)
{
// BEGIN MOD: AbleMods.com
// bind meta tags using PageHelper routine
PageHelper.BindMetaTags(this.Page, _Category);
// END MOD: AbleMods.com
Page.Title = _Category.Name + " at " + Token.Instance.Store.Name + ".com";
Caption.Text = _Category.Name;
if (!string.IsNullOrEmpty(_Category.Description))
{
CategoryDescriptionPanel.Visible = true;
CategoryDescription.Text = _Category.Description;
}
else CategoryDescriptionPanel.Visible = false;
}
else
{
// IF IT IS ROOT CATEGORY
Page.Title = DefaultCaption + " at " + Token.Instance.Store.Name;
Caption.Text = DefaultCaption;
CategoryDescriptionPanel.Visible = false;
}
}
else
{
CategoryHeaderPanel.Visible = false;
}
BindSearchResultsPanel();
}