Do search engines index HTML comments?
Monday, August 18th, 2008We’ve spent a lot of time on this blog talking about how to get your content into search engines but sometimes there are things you don’t want to get indexed. Sure you can use robots.txt and no-follow links to block search engines from indexing entire pages but we were curious about one thing: HTML comments. Do search engines read and index them?
For many of us HTML comments can contain embarassing or even proprietary information we’d prefer to keep hidden from the general page-viewing public. How many times have you written something like ‘messy code, I’ll clean this up later’ in the comments or even left database connection strings or development notes on a page by mistake? We certainly don’t condone the latter because while HTML comments are hidden from the casual browser a simple ‘view source’ will reveal your notes to anyone and everyone who pokes around.
But back to the question at hand: Do search engine spiders index HTML comments? Based on our tests the major search engines (Google, Yahoo, and MSN) do not index HTML comments - fortunate for many of us. It appears there is no need to go through and scrub your pages with comments right away but it’s still a good idea to write HTML comments AS IF they were potentially being indexed because you never know who is viewing your source.
If you were considering keyword stuffing your page through the use of HTML comments clearly this won’t work but you might be interested in our hidden DIV and hidden text posts.
Once again we’re out of SEO test results so let us know what SEO myths you’d like to see put to an objective test.
