Does anyone know if there is an easy way of making category titles populate the meta description and meta keyword fields automatically.
Thanks in advanced
Meta tag code
Re: Meta tag code
Can you be more specific? What version of AbleCommerce are you using?
There should be a title field available for categories. I believe the feature was added to Gold R6 in Sept. 2013.
I'm not sure it would be advisable to populate this with your meta description and/or keywords since the title has it's own requirements, and it is different than meta info.
There is lots of great info that you can find on SEO. Here is one page that has some basic requirements for the Title field.
http://searchenginewatch.com/sew/how-to ... lden-rules#
There should be a title field available for categories. I believe the feature was added to Gold R6 in Sept. 2013.
I'm not sure it would be advisable to populate this with your meta description and/or keywords since the title has it's own requirements, and it is different than meta info.
There is lots of great info that you can find on SEO. Here is one page that has some basic requirements for the Title field.
http://searchenginewatch.com/sew/how-to ... lden-rules#
Thank you for choosing AbleCommerce!
http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support
http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support
Re: Meta tag code
Running Gold R10 Responsive. When working with categories if you leave the page title field empty it will automatically populate the meta title by using the name. Obviously there is code for this to be done and my question is if there is already code that auto populates the meta title from the page name should it not be easy to add some code to populate the meta description and meta keywords from the page name as well. I have over 20000 categories and cannot imagine doing each one individually. As a matter of fact I had paid for a program several years ago for ac7 that did just that but does not work with gold. If not, could you point me in the direction of where the code is that currently does the above mentioned function.
Thanks
Thanks
Re: Meta tag code
Hello grgalex,
If you go to Website/App_Code/PageHelper.cs and go to the BindMetaTags() function, you should be able to find what you need to get started.
If you go to Website/App_Code/PageHelper.cs and go to the BindMetaTags() function, you should be able to find what you need to get started.
Ryan A.
Scott's Bait and Tackle
http://store.scottsbt.com
Work In Progress
Able Gold R10
Bootstrap 3.3
Scott's Bait and Tackle
http://store.scottsbt.com
Work In Progress
Able Gold R10
Bootstrap 3.3
Re: Meta tag code
Are you able to achieve your desired goal? This is super easy to make it work as rmaweb suggested. You just need to locate the following code inside BindMetaTags() function:
and replace with
Edit: Wrapped the code inside if...else to make it specific to the category objects.
This should work the way you want it.
Code: Select all
if (!string.IsNullOrEmpty(catalogObject.MetaDescription))
{
htmlHead.Append(Environment.NewLine);
htmlHead.Append(string.Format("<meta name=\"description\" content=\"{0}\" />", HttpUtility.HtmlEncode(catalogObject.MetaDescription)));
}
if (!string.IsNullOrEmpty(catalogObject.MetaKeywords))
{
htmlHead.Append(Environment.NewLine);
htmlHead.Append(string.Format("<meta name=\"keywords\" content=\"{0}\" />", HttpUtility.HtmlEncode(catalogObject.MetaKeywords)));
}
Code: Select all
if (catalogObject.CatalogNodeType == CatalogNodeType.Category)
{
if (!string.IsNullOrEmpty(catalogObject.MetaDescription))
{
htmlHead.Append(Environment.NewLine);
htmlHead.Append(string.Format("<meta name=\"description\" content=\"{0}\" />", HttpUtility.HtmlEncode(catalogObject.MetaDescription)));
}
else
{
htmlHead.Append(Environment.NewLine);
htmlHead.Append(string.Format("<meta name=\"description\" content=\"{0}\" />", HttpUtility.HtmlEncode(catalogObject.Name)));
}
if (!string.IsNullOrEmpty(catalogObject.MetaKeywords))
{
htmlHead.Append(Environment.NewLine);
htmlHead.Append(string.Format("<meta name=\"keywords\" content=\"{0}\" />", HttpUtility.HtmlEncode(catalogObject.MetaKeywords)));
}
else
{
htmlHead.Append(Environment.NewLine);
htmlHead.Append(string.Format("<meta name=\"keywords\" content=\"{0}\" />", HttpUtility.HtmlEncode(catalogObject.Name)));
}
}
else
{
if (!string.IsNullOrEmpty(catalogObject.MetaDescription))
{
htmlHead.Append(Environment.NewLine);
htmlHead.Append(string.Format("<meta name=\"description\" content=\"{0}\" />", HttpUtility.HtmlEncode(catalogObject.MetaDescription)));
}
if (!string.IsNullOrEmpty(catalogObject.MetaKeywords))
{
htmlHead.Append(Environment.NewLine);
htmlHead.Append(string.Format("<meta name=\"keywords\" content=\"{0}\" />", HttpUtility.HtmlEncode(catalogObject.MetaKeywords)));
}
}
This should work the way you want it.