Search code examples
web-crawlergoogle-search-console

How to exclude part of a web page from google's indexing?


There's a way of excluding complete page(s) from google's indexing. But is there a way to specifically exclude certain part(s) of a web page from google's crawling? For example, exclude the side-bar which usually contains unrelated contents?


Solution

  • You can include with an IFRAME tag the part of the page that you want hide at Googlebot and block the indexing of the file included from the robots.txt file.

    add the iframe for include the side-bar in your page

    <iframe src ="sidebar.asp" width="100%" height="300">
        </iframe>
    

    here the rules to be added in the robots.txt file for block the spider

    user-agent: *
    disallow: sidebar.asp