NOPcommerce 1.80页面标题商店前缀 - >后缀

时间:2012-03-01 22:24:13

标签: store title nopcommerce

在NOP中,有没有办法使用商店前缀作为后缀并稍微修改一下?例如,我想改变这个:

{prefix}. {title}

{title} | {prefix}

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:1)

是否必须是nopCommerce 1.80?

在最新版本2.40中,您可以在常规和其他设置下更改此设置 - > SEO设置。

page title separator更改为'| '和page title SEO adjustment到'页面名称来自商店名称'。

[edit]根据您的评论,您必须使用v1.80,以下内容适用:

您必须编辑RenderTitle类中的NopCommerce.BusinessLogic.SEO.SEOHelper方法,以覆盖默认的网页标题格式。

在你的情况下,你会希望有类似的东西:

public static void RenderTitle(Page page, string title, 
        bool includeStoreNameInTitle, bool overwriteExisting)
{
    if (page == null || page.Header == null)
        return;

    /* Change starts here */

    if (includeStoreNameInTitle)
        title = title + " | " + SettingsManager.StoreName;

    /* Change ends here */ 

    if (String.IsNullOrEmpty(title))
        return;

    if (overwriteExisting)
        page.Title = HttpUtility.HtmlEncode(title);
    else
    {
        if (String.IsNullOrEmpty(page.Title))
            page.Title = HttpUtility.HtmlEncode(title);
    }
}