简体   繁体   中英

Google Custom Search results includes html with “nocontent” tag

Our site have Google Custom Search set up. 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”. The rest of the CSE file is left to default. 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. The page have been running with the “nocontent” class on the menu for 2 weeks.

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

This is an example of our menu 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.

This is our cse.xml file:

 <?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.


I think you might be misinterpreting the purpose of the nocontent class. 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.

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. 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.

You can find some more discussion on this topic in the Google Custom Search support forums, for example in this thread .

PS There is a different product, the Google Search Appliance, which does support excluding content from indexing via googleoff / googleon tags.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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