简体   繁体   English

Google自定义搜索结果包含带有“nocontent”标记的html

[英]Google Custom Search results includes html with “nocontent” tag

Our site have Google Custom Search set up. 我们的网站设置了Google自定义搜索。 Instructions from Google have been followed, including downloading the CSE.xml file and adding “a new attribute enable_nocontent_tag="true" to the CustomSearchEngine tag”. 已遵循Google的说明,包括下载CSE.xml文件并向CustomSearchEngine标记添加“新属性enable_nocontent_tag =”true“。 The rest of the CSE file is left to default. CSE文件的其余部分保留为默认值。 The Search engine keywords field have been left empty. 搜索引擎关键字字段已留空。 The “nocontent” class have been added to the menu and the underlying menu items which exists on all pages. “nocontent”类已添加到菜单和所有页面上存在的基础菜单项。 The page have been running with the “nocontent” class on the menu for 2 weeks. 页面已在菜单上运行“nocontent”类2周。

The problem is that if the searchterm occurs in the menu it will then appear in the results. 问题是,如果在菜单中出现searchterm,它将出现在结果中。

This is an example of our menu html: 这是我们的菜单html的一个例子:

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

When we go to Google Search Console under the menu item “Crawl” and use Fetch as Google, then the html comes up as expected with the “nocontent” class on the menu. 当我们在菜单项“Crawl”下访问Google Search Console并使用Fetch as Google时,html会按预期显示菜单上的“nocontent”类。

This is our cse.xml file: 这是我们的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> 

Note: I'm assuming that your question is the following statement: 注意:我假设您的问题是以下声明:

The problem is that if the searchterm occurs in the menu it will then appear in the results. 问题是,如果在菜单中出现searchterm,它将出现在结果中。


I think you might be misinterpreting the purpose of the nocontent class. 我想你可能会误解nocontent类的目的。 The documentation says: 文件说:

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. 当Google自定义搜索看到此标记时,我们会忽略其中包含的所有关键字,并且在计算自定义搜索引擎的排名时不会将其考虑在内。

At the end of that document is also the following section: 该文件的最后还有以下部分:

Using nocontent won't impact your site's performance in Google Web Search, or our crawling of your site, in any way. 使用nocontent不会以任何方式影响您网站在Google网页搜索中的效果,也不会影响我们对您网站的抓取。 We'll continue to follow any links in tagged content; 我们会继续关注标记内容中的任何链接; we just won't use keywords to calculate ranking for your Custom Search engine. 我们不会使用关键字来计算自定义搜索引擎的排名。

So, the purpose of nocontent is not to prevent the included content from appearing in your CSE results but just to prevent any keywords in the included content from influencing the ranking of the results. 因此, nocontent的目的不是阻止包含的内容出现在您的CSE结果中,而只是为了防止包含的内容中的任何关键字影响结果的排名

You can find some more discussion on this topic in the Google Custom Search support forums, for example in this thread . 您可以在Google自定义搜索支持论坛中找到有关此主题的更多讨论,例如在此主题中

PS There is a different product, the Google Search Appliance, which does support excluding content from indexing via googleoff / googleon tags. PS有不同的产品,谷歌的Search Appliance的,它 支持通过从索引中排除的内容googleoff / googleon标签。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM