19

I would like to know if Google or any other search engine would regard a comment in the source-code containing a link:

    <!-- domain.com -->

as a back-link.

If yes how much weight is put onto it and if no why do so many script include back-links in the source-code commenting.

1
  • It's not at all an <a> link with anchor text, it's not a back link period.
    – Anagio
    Mar 10, 2012 at 10:22

3 Answers 3

9

Googlebot will index hidden <div class="display:none;"> content, but will also consider the CSS and ajax/flash when working out if this information should be included in the Google index - this is important because it means that Google will index Lazy loaded comment sections and other similar content.

Other hidden information like the <!-- comments --> you ask about are ignored. I can't find official information to back this up, but it's easy to test by searching for commented information you know exists. So no, it wouldn't count as a backlink or confer other benefits.

The Bot's gotten very good at distinguishing between content hidden for SEO or discovery reasons and content hidden for acceptable reasons e.g. keyword or link stuffing. So it's best avoided lest you suffer a penalty.

In short, Google should see whatever a user sees, this discussion about hidden divs at google webmaster help should be informative regarding hidden content (Quoted Below).

Quoting user softplus:-

Hi Bill

Hidden text when misleading and off-topic can result in penalties and bans. It is however almost impossible for Google to determine whether or not text is misleading and hidden automatically. If your page's user interface depends on hidden elements that is generally not a problem (but it might result in your pages being indexed suboptimally - eg when you have several text-elements on the same page all accessable through the same URL).

You can easily confirm that Google indexes hidden content like that by placing unique text in one of those blocks, waiting for the page to be re-indexed and then searching for it.

The reason Google reacts so strongly against misleading hidden text and links is because they do index them correctly (and therefore they do "work"). If Google were to just ignore hidden text, many sites would try to use it. By giving a strong penalty (or even ban) the risk involved with using hidden text to gain advantages is often larger than the possible gain. (not to mention that you can usually just put the same text in the visible sections of your pages anyway!)

If your hidden content is NOT sneaky, misleading, off-topic, etc then you should have nothing to worry about. Many sites use hidden content in one form or other as critical parts of the interface.

John

To answer your second question most <scripts> include urls for three reasons:-

  • Self promotion - i.e. people chasing down plugins that they might want to use.

  • Licencing - i.e. indicating the circumstances the script can be used under and what rights the author retains to the code.

  • Updates/Documentation - i.e. allowing site owners to find the script source quickly so they can check for updates or instructions.

e.g.

/*
 * FancyBox - jQuery Plugin
 * Simple and fancy lightbox alternative
 *
 * Examples and documentation at: http://fancybox.net
 * 
 * Copyright (c) 2008 - 2010 Janis Skarnelis
 * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
 * 
 * Version: 1.3.4 (11/11/2010)
 * Requires: jQuery v1.3+
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
6
  • 2
    I think you've confused the example given with another type of code implementation. OP is asking about links within commented code. Mar 10, 2012 at 9:35
  • His question is if it counts as a back-link. HTML comments are wrapped in standard comment tags. Hidden content in a div tag or any other tag hidden for that matter is slightly different.
    – Anagio
    Mar 10, 2012 at 10:20
  • @Anagio it's all hidden content and my answer covers both cases Mar 10, 2012 at 10:34
  • It's not a link though, he's not stuffing links anyplace or gaining any back-links. Hidden content IMO is another topic where search engines may or may not use it to determine the relevance of a page. I'm sure since they recognize micro formats they would recognize the opening and closing of comment tags.
    – Anagio
    Mar 10, 2012 at 10:36
  • 1
    @Anagio the my answer addresses BOTH the OP's questions and the broader subject of hidden content as both topics are connected. The reverse view of the question is 'if Google does not index comments, does it index other hidden content'. Mar 10, 2012 at 12:10
2

Links included in HTML Comments are just that - comments. They are not displayed or rendered in the output to the browser, so they are effectively ignored by search engines.

They have no SEO value what-so-ever - except for the possibility of discovery.

While not from the "horses" mouth per-se, here's some answers to the same question on Google Webmaster Help forum.

2

That is not a valid link, it's just a source comment. There is no chance at all that a search engine will see domain.com within an HTML comment and consider it an HTML link

Not the answer you're looking for? Browse other questions tagged or ask your own question.