3

I know Google nowadays is pretty good at scanning the DOM and adding stuff to your site using javascript isn't a problem anymore.

Thing is, I'm using JavaScript (jQuery) to collect information from a perfectly good structured web-page to make some sort of widget. I'm too ashamed to show code because, really, it's a bit of a mess. And not really relevant to my question.

So in the original content there's something like this:

<h2>Title</h2>
<p>Content here</p>
<h2>Title two</h2>
<p>Content two</p>

I'm collecting stuff from all over the page to rearrange it into stuff I don't want Google to see like this:

<div class="titles-wrap"><a href="#">Title</a><a href="#">Title two</a></div>
<div class="content-wrap"><div class="content">content here</div><div class="content">Content two</div></div>

Again, please don't just my old and horrible ways of thinking here.

Does Google now read the original semantically pretty version or the JavaScript ruined version?

5
  • 2
    Google renders JavaScript so they'll see whatever it produces
    – John Conde
    Aug 16, 2017 at 13:51
  • 1
    In addition to what John says: go to Google Webmaster Console and use the 'Fetch and render' option to see exactly what Google sees when they visit your webpage. Aug 16, 2017 at 14:16
  • So would it be safe to say that google now indexes the altered source-code AFTER DOM-adjustments?
    – Dio Vayne
    Aug 22, 2017 at 6:18
  • A simple way to do this is to use a robotted javascript file. That said, I don't think I've run across a site where hiding something that was useful to users was ever necessary for search. My feeling is you're overcomplicating something that you can ignore. Aug 23, 2017 at 9:02
  • 1
    I'm not actually trying to hide content, but rearranging it. (That does indeed hiding/removing content and place a copy somewhere else.)
    – Dio Vayne
    Aug 24, 2017 at 9:12

1 Answer 1

1

After some tests between Google cache and fetch as Google i've realized, that the average time Google waits after onLoad, whether any javascript loaded content will come, is 5-6 seconds. So if your goal is to hide something from Google, you should load your stuff much later.

Another method is to bind the loading on any user action. But since Googlebot seems to be be headless Chrome i don't very believe, that it can't accomplish user actions - my test results were till now not meaningful enough.

2
  • 1
    This is cloaking and they do human as well as browser audits to try and catch this. If you're a popular site be very wary of how the technique is used.
    – L Martin
    Aug 18, 2017 at 8:35
  • 3
    Cloaking is the opposite: showing something to Google, but hiding it from users. Google generally doesn't care if it misses indexing some of your content, but it cares a great deal if it indexes something that users can't find on your site after they get there searching for it. Aug 18, 2017 at 9:51

Your Answer

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

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