I understand and know how hiding things from your website works and how the search engine spiders will still be able to ¨see¨ this hidden element and penalize your website for it.

Thing is, I did not find any information on how to hide these HTML elements visually AND also hide them from the search engine spiders. Therefore by doing so, hiding HTML element won't be considered Black Hat SEO or Cloaking by web spiders, so your page won't suffer further repercussions. I mean, in the end you just want to hide things from both! the user and the spider...

I mean, I know it might be a dumb question to ask, like: ¨Why don't you just remove the freaking tag from your page source and that's it?¨¨

But to be honest, I'm just intrigued if this even something doable?

It would be useful to know if for example, let's say that you're working on a website template which you have no access to its core files so you can't just go in there and simply remove the tag and the only thing you can actually edit it's the CSS file.

I just really want to know if this is doable somehow for educational purposes.

  • You can remove HTML elements from the DOM so users won't see them using JavaScript's document.getElementById, or with JQuery's remove element. This should work with users and advanced search engines like Google that process JavaScript. This won't work with search engines that don't process JavaScript. The only reliable way for all users and search engines is to use a server-side script to fetch/include the page and parse out the element (Perl's WWW::Mechanize does this nicely).
    – dan
    Commented Sep 19, 2018 at 4:24

1 Answer 1


If you can view the source code for the web page and view the content there, then it is visible to search engine spiders. There is no way to hide content from the "view source" other than removing it entirely.

Hiding content with CSS or JavaScript puts your site at risk of search engine penalties for cloaking. There are a few things that mitigate that risk:

  • You can allow users to show hidden content by clicking. You can initially hide content that is in a second tab, on in a popup as long as users can get to it in an obvious way.
  • You can hide content that isn't keyword rich without much risk. For example you would be likely to be penalized for hiding a list of keywords: blue widgets, blue widget, buy blue widget, but you would be unlikely to be penalized for hiding template created by fishguy.
  • Rather than penalize, Google often just doesn't index content that isn't shown to the user. However, Google recently said that they do index content that isn't shown to the user by default even though testing has shown that they don't: https://www.seroundtable.com/google-index-rank-content-in-accordions-tabs-fully-26379.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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