简体   繁体   中英

Will search engines penalise text hidden by javascript?

I have this html code and want to use the text in the divs who are children to "divHiddenTexts" for a javascript slider and I want search engines be able to find the text. What I don't want is a penalty for hiding the text with CSS which is discussed in this question SEO : Is h1 tag that's hidden using display:none given prominence by Search engines ?

My question is: Will I get penalised if I hide text with javascript instead?

By adding the class "hidden" in a DOM ready function. I have read that search bots don't have javascript turned on so they will see the text without finding it "spam-like" right?

  <div id="divHiddenTexts" class="hidden">
        <div>
            Some text...bla bla bla
        </div>
        <div>
            Some other text...more blaha.
        </div>
        <div>
            Even more text...
        </div>            
   </div>

Search engines are concerned about spamming. They have complex algorithms to detect various spamming techniques, such as stuffing a page with keywords which are then hidden by some means.

In your case the content is a perfectly legitimate part of the page, which is then manipulated by JavaScript. Even if search engines were able to detect that the text was being concealed by scripting, it would still not come under the category of spamming, and would not be penalised.

There's a lot of rubbish talked about this subject, much of it based on endlessly-recycled speculation by unknowledgeable people, usually traceable back to some article from seven or eight years ago that isn't even really relevant anymore (and was probably written by a spammer complaining about getting caught). The technique you are using is perfectly OK, and will not damage your site's ranking.

See Matt Cutts' video: How not to hide text

Google is getting good at detecting things like hidden text. However, it's not necessarily going to have a negative impact. If you have a Javascript menu, for example, they can't penalise you for that since its a fair use of hiding/unhiding.

Fair content is the best way to score high, and stay high.
Even if search-engine X does NOT give you negative points for such an action now, it might in the future. (and should!)
Use google's tools to check your status/receive hints.

As a rule of thumb - generally Google doesn't like being presented with something that a isn't shown to a normal website visitor. So, for instance, if a user cannot see the text, and Googlebot can, it PROBABLY won't like it.

But, in the grand scheme of things, this will have a very minor affect on your SERP. Especially considering that on-page factors don't have a massive affect on your ranking.

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