Google 自定义搜索结果包括 html 带有“nocontent”标签

Google Custom Search results includes html with “nocontent” tag

我们的站点设置了 Google 自定义搜索。已遵循 Google 的说明,包括下载 CSE.xml 文件并添加“新属性 enable_nocontent_tag="true" 到 CustomSearchEngine 标记”。 CSE 文件的其余部分保留为默认值。搜索引擎关键字字段已留空。 “nocontent”class 已添加到菜单和存在于所有页面上的基础菜单项中。该页面 运行 菜单上的“无内容” class 已经 2 周了。

问题是,如果搜索项出现在菜单中,它将出现在结果中。

这是我们的菜单示例 html:

<header class="nocontent page-head">
 <nav class="main-nav-section">
  <ul>
   <li class="nocontent">
    <a href="###">###</a>
   </li>
  </ul>
 </nav>
</header>

当我们转到菜单项“抓取”下的 Google Search Console 并使用 Fetch as Google 时,html 会按预期出现“无内容”class 在菜单上。

这是我们的 cse.xml 文件:

<?xml version="1.0" encoding="UTF-8" ?>
<CustomSearchEngine id="###" creator="###" language="da" encoding="UTF-8" enable_suggest="true" enable_nocontent_tag="true">
  <Title>###</Title>
  <Description>###</Description>
  <Context>
    <BackgroundLabels>
      <Label name="_cse_hinwieyku6m" mode="FILTER" />
      <Label name="_cse_exclude_hinwieyku6m" mode="ELIMINATE" />
    </BackgroundLabels>
  </Context>
  <LookAndFeel nonprofit="false" element_layout="1" theme="7" custom_theme="true" text_font="Arial, sans-serif" url_length="full" element_branding="show" enable_cse_thumbnail="true" promotion_url_length="full" ads_layout="1">
    <Logo />
    <Colors url="#008000" background="#FFFFFF" border="#FFFFFF" title="#0000CC" text="#000000" visited="#0000CC" title_hover="#0000CC" title_active="#0000CC" />
    <Promotions title_color="#0000CC" title_visited_color="#0000CC" url_color="#008000" background_color="#FFFFFF" border_color="#336699" snippet_color="#000000" title_hover_color="#0000CC" title_active_color="#0000CC" />
    <SearchControls input_border_color="#D9D9D9" button_border_color="#666666" button_background_color="#CECECE" tab_border_color="#E9E9E9" tab_background_color="#E9E9E9" tab_selected_border_color="#FF9900" tab_selected_background_color="#FFFFFF" />
    <Results border_color="#FFFFFF" border_hover_color="#FFFFFF" background_color="#FFFFFF" background_hover_color="#FFFFFF" ads_background_color="#fff7f5" ads_border_color="#FFFFFF" />
  </LookAndFeel>
  <AdSense />
  <EnterpriseAccount />
  <ImageSearchSettings enable="false" />
  <autocomplete_settings />
  <sort_by_keys label="Relevance" key="" />
  <sort_by_keys label="Date" key="date" />
  <cse_advance_settings enable_speech="true" />
</CustomSearchEngine>

注意:我假设您的问题是以下陈述:

The problem is that if the searchterm occurs in the menu it will then appear in the results.


我认为您可能误解了 nocontent class 的目的。 documentation 表示:

When Google Custom Search sees this tag, we'll ignore any keywords it contains and won't take them into account when calculating ranking for your Custom Search engine.

该文档的末尾还有以下部分:

Using nocontent won't impact your site's performance in Google Web Search, or our crawling of your site, in any way. We'll continue to follow any links in tagged content; we just won't use keywords to calculate ranking for your Custom Search engine.

所以,nocontent的目的不是防止包含的内容出现在您的CSE结果中,只是为了防止包含的内容中的任何关键字产生影响结果的排名

您可以在 Google 自定义搜索支持论坛中找到更多关于此主题的讨论,例如 this thread

P.S。有一个不同的产品,Google Search Appliance, support 通过 [=13] 排除来自 indexing 的内容=]/googleon 个标签。