Close

category pages title

kh_s
one year ago
#21938 Quote
Avatar
  • 5
Hi, blog category pages title and blog page title they are the same.i created 5 categories for blog with rich blog, now with blog page in my site 6 pages They have the same h1.
You know that in terms of SEO, 2 pages should not have the same h1. can i resolve this?
todor.atanasov
one year ago
#21951 Quote
Avatar
  • Moderator
  • 249
kh_s wrote:
Hi, blog category pages title and blog page title they are the same.i created 5 categories for blog with rich blog, now with blog page in my site 6 pages They have the same h1.
You know that in terms of SEO, 2 pages should not have the same h1. can i resolve this?


Greetings,

Thank you for reaching out to us!

Unfortunately, we cannot override the nopCommerce view, but this change would be possible with a small modification to the view in question - \Views\Blog\List.cshtml (or the overridden equivalent if you are using one of our themes which is overriding this file).

With the new version of Rich Blog 4.5, that we have released just now, we have added a custom property called CurrentCategoryName, that can be used in the view to replace the static <h1> element.

After you update the plugin to the latest version, you have to add two things to \Views\Blog\List.cshtml (or \THEME_NAME\Views\Blog\List.cshtml if it exists):

In the C# code section at the top, you have to add the following code:

var currentCategoryName = Model.CustomProperties.ContainsKey("CurrentCategoryName") ? Model.CustomProperties["CurrentCategoryName"] : "Blog";

So now the C# code section should look like this:

@{
    Layout = "_ColumnsTwo";

    //title
    NopHtml.AddTitleParts(T("PageTitle.Blog").Text);
    //page class
    NopHtml.AppendPageCssClassParts("html-blog-page");

    var currentCategoryName = Model.CustomProperties.ContainsKey("CurrentCategoryName") ? Model.CustomProperties["CurrentCategoryName"] : "Blog";
}

After this, you may replace:

@T("Blog")

with

@currentCategoryName;

P.S.: Please let me know if you are not using nopCommerce 4.5
Best regards,
Todor Atanasov
Nop-templates.com