Strange thing happening with category definition field/property
Hey guys,
So I added a "metaDescripton" short text field to my Default category description, which I wanted to use to put a custom meta description for individual category pages. This worked fine.
However, despite me not pulling out the meta description, (<category ...><properties><metaDescription>blah</metaDescription></properties>...</category>) as soon as the template for $category/category was matched in my category page XSLT, this meta field was being displayed on the website. I could literally empty out everything in my XSLT as long as I still matched the category, and I would still see my custom field displaying on the website.
I tried unchecking "Display on website" in the definition page for the field, but no dice.
I have a similar sort of problem, I am quite new to this so please forgive my unwillingness to learn approach and I am still trying to understand the true meaning of 123.
Anyways I have Umbraco version: 7.2.1 Installed with uCommerce version: 6.5.3.14346
Within uCommerce and under Settings > Definitions and both under Category Definitions and Product Definitions, I have added the metaKeywords as shorttext and metaDescription as Longtext fields as instructed in the uCommerce SEO Document, but even in the document it does not explain what to do next or referance to a step by step guide.
So far so good, I have then under uCommerce Shop structure gone and populated the metaKeywords and metaDescription for all categories and products within the categories.
My issue is: what do I need to do next? to get it to display within the meta keyword tag and meta description tag in the site.master within . At the moment my meta tags for both keyword and description are empty. I would apricate a solution in razor script as the project that I am working on is built on MVC Razor.
<html xmlns:umbraco="http://umbraco.org" lang="en">
<head>
<title>welcome to my first website</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
</head>
<body>
<!-- some body text here -->
</body>
Not to worry anymore, I have now managed to resolve this issue and with a bit of guidance and help of the master himself Søren Spelling.
What did I do to get this resolved?
Step 1:
Create custom Data type for metaKeywords and metaDescription under Setting > Defenitions and both under Product Definitions and Category Definistions.
Step 2:
Within the Catelog tree populate the Keywords and Description for both Categories and Product Items.
Now that we have completed the uCommerce Section for SEO we need to move down to code level.
Step 1: Create Razor file and Name it what you want in this case I have named mine as metaDescription.cshtml
Step 2: Add the below code:
@using UCommerce.Extensions
@using UCommerce.Runtime
@{
var prodItem = SiteContext.Current.CatalogContext.CurrentProduct;
var catItem = SiteContext.Current.CatalogContext.CurrentCategory;
if (catItem != null && prodItem == null)
{
@Html.Raw(catItem.DynamicProperty().yourMetaDescriptionFieldName);
}
else if (prodItem != null)
{
@Html.Raw(prodItem.DynamicProperty().yourMetaDescriptionFieldName);
}
else
{
//do something... maybe call your umbraco pageDescription i.e. @Modle.YourDescriptionFieldName
//to use the umbraco fields make sure to inherit the umbraco.MacroEngines.DynamicNodeContext at the top
}
}
Step 3: Create a Macro and hook it up with your new Razor script.
Step 4: Call the macro within the Description meta tag of your yourMainSite.master file.
For Keywords and Titles, repeat the Coding steps 1 to 4 for each one.
Strange thing happening with category definition field/property
Hey guys,
So I added a "metaDescripton" short text field to my Default category description, which I wanted to use to put a custom meta description for individual category pages. This worked fine.
However, despite me not pulling out the meta description, (<category ...><properties><metaDescription>blah</metaDescription></properties>...</category>) as soon as the template for $category/category was matched in my category page XSLT, this meta field was being displayed on the website. I could literally empty out everything in my XSLT as long as I still matched the category, and I would still see my custom field displaying on the website.
I tried unchecking "Display on website" in the definition page for the field, but no dice.
Add this to your template.
It will grab the properties and display nothing.
Hi,
I have a similar sort of problem, I am quite new to this so please forgive my unwillingness to learn approach and I am still trying to understand the true meaning of 123.
Anyways I have Umbraco version: 7.2.1 Installed with uCommerce version: 6.5.3.14346
Within uCommerce and under Settings > Definitions and both under Category Definitions and Product Definitions, I have added the metaKeywords as shorttext and metaDescription as Longtext fields as instructed in the uCommerce SEO Document, but even in the document it does not explain what to do next or referance to a step by step guide.
So far so good, I have then under uCommerce Shop structure gone and populated the metaKeywords and metaDescription for all categories and products within the categories.
My issue is: what do I need to do next? to get it to display within the meta keyword tag and meta description tag in the site.master within . At the moment my meta tags for both keyword and description are empty. I would apricate a solution in razor script as the project that I am working on is built on MVC Razor.
Please help and guide me step by step.
KR
/Bhav
Not to worry anymore, I have now managed to resolve this issue and with a bit of guidance and help of the master himself Søren Spelling.
What did I do to get this resolved?
Step 1: Create custom Data type for metaKeywords and metaDescription under Setting > Defenitions and both under Product Definitions and Category Definistions.
Step 2: Within the Catelog tree populate the Keywords and Description for both Categories and Product Items.
Now that we have completed the uCommerce Section for SEO we need to move down to code level.
Step 1: Create Razor file and Name it what you want in this case I have named mine as metaDescription.cshtml
Step 2: Add the below code:
Step 3: Create a Macro and hook it up with your new Razor script.
Step 4: Call the macro within the Description meta tag of your yourMainSite.master file.
For Keywords and Titles, repeat the Coding steps 1 to 4 for each one.
I hope you find this helpful.
KR
/Bhav (www.bnpdigitalmedia.com – bringing technology closer)
is working on a reply...