hi i achieved this by making some changes in the following files
0) Presentation/Nop.Web/Views/Home/index.cshtml
1) Presentation/Nop.Web/Views/Shared/_Rool.Head.cshtml
2) Presentation/Nop.Web.Framework/UI/LayoutExtension.cs
3) Presentation/Nop.Web.Framework/UI/IPageTitleBuilder.cs
4) Presentation/Nop.Web.Framework/UI/PageTitleBuilder.cs
changes in 0) Presentation/Nop.Web/Views/Home/index.cshtml
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_ColumnsThree.cshtml";
}
changes in 1) Presentation/Nop.Web/Views/Shared/_Rool.Head.cshtmlmodify after the head tag.
@{
var flag = false;
if (ViewData.ContainsKey("title"))
{
if (ViewData["title"] == "Index") // write your logic here for some other pages.
{
flag = true;
}
}
}
<title>@Html.NopTitle(flag)</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<meta name="description" content="@(Html.NopMetaDescription(flag))" />
<meta name="keywords" content="@(Html.NopMetaKeywords(flag))" />
changes in 2) Presentation/Nop.Web.Framework/UI/LayoutExtension.csadded new parameter
bool addDefaultDescription,
public static MvcHtmlString NopMetaDescription(this HtmlHelper html, bool addDefaultDescription, params string[] parts)
{
var pageTitleBuilder = EngineContext.Current.Resolve<IPageTitleBuilder>();
html.AppendMetaDescriptionParts(parts);
return MvcHtmlString.Create(html.Encode(pageTitleBuilder.GenerateMetaDescription(addDefaultDescription)));
}
do the same for NopMetaKeywords method too.
changes in 3) Presentation/Nop.Web.Framework/UI/IPageTitleBuilder.cs
string GenerateMetaDescription(bool addDefaultDescription);
string GenerateMetaKeywords(bool addDefaultKeywords);
changes in 4) Presentation/Nop.Web.Framework/UI/PageTitleBuilder.cs
public string GenerateMetaDescription(bool addDefaultDescription)
{
var metaDescription = string.Join(", ", _metaDescriptionParts.AsEnumerable().Reverse().ToArray());
var result = string.Empty;
if (addDefaultDescription)
result = !String.IsNullOrEmpty(metaDescription) ? metaDescription : _seoSettings.DefaultMetaDescription;
else
result = !String.IsNullOrEmpty(metaDescription) ? metaDescription : string.Empty;
return result;
}
do the same for GenerateMetaKeywords method too.