1

I have read many articles about how Google handles AJAX loaded content, and I am aware that Google is now supposed to index your page like any modern browser now. However, I am still seeing much of the content of my site not getting indexed.

I can't post a link to the site (client confidentiality) - but my situation is as follows: One section on my site has a grid of images - when clicked, further content is loaded via AJAX and displayed on page. This can be closed, and next item in the grid can be clicked to load further content.

Here is an example of the type of code I'm using. (This is an example and not the exact code but gives an idea). Note: I am binding the AJAX event to the a tag on load - and the tag does not have a href attribute (I'm not sure if this is important).

<div id="item 1" class="GridItem">
  <img  src="/img1.jpg" >         
  <h3>Section 1</h3>
  <a data-id="12345" class="showInfo"></a>
</div>
<div id="item 2" class="GridItem">
  <img  src="/img2.jpg" >         
  <h3>Section 2</h3>
  <a data-id="12346" class="showInfo"></a>
</div>
<div id="item 3" class="GridItem">
  <img  src="/img3.jpg" >         
  <h3>Section 3</h3>
  <a data-id="12347" class="showInfo"></a>
</div>
<div id="infoContainer"></div>

 $(document).ready(function () {
      $('.showInfo').unbind().on('click touchend', function (ev) {
            ev.preventDefault();
            $("#infoContainer").load('/ajaxpage?id=' + $(this).attr('data-id'), function () {  

              });
        });
});

I want to avoid having all my content loaded on page and hidden - not only will this likely have a negative SEO impact (hidden content is not a good idea) - it would add a large load overhead.

6
  • You can't force Google to index content. There are very few websites that get all their content indexed. Google chooses which content to index and often chooses not to index many pages. See Why aren't search engines indexing my content? Mar 12, 2018 at 9:58
  • 2
    Google only indexes content that users can see when they load the page. When you change the content on the page you need to change the URL using pushState and provide Googlebot a link (with a href) to that content. Mar 12, 2018 at 10:02
  • So, if I had a different "#" in the URL for each panel that's open - and force this to load on page load - Google will index. Will it treat it all as one page, or index each one individually however?
    – mp3duck
    Mar 12, 2018 at 13:45
  • I wouldn't use hash URLs. Google doesn't support the # in URLs very well. pushState allows you to use better supported normal looking URLs without a fragment identifier. Like hash URLs, the page isn't refreshed so users get the AJAX experience. Mar 12, 2018 at 14:07
  • @StephenOstermiller - So, with push state, I am getting a different URL, so if I'm not mistaken, Google treat each one as a separate page in the index? Would the same apply if I just changed the query string with push state? Ideally, I'd like all the content index one the single page?
    – mp3duck
    Mar 13, 2018 at 8:52

1 Answer 1

-1

While not ideal for your present situation, you theoretically shouldn't need to do anything very soon:

https://searchengineland.com/google-will-stop-crawling-old-ajax-crawling-scheme-q2-2018-287653

I would use 'fetch and render' in Google Search Console as a first step to solving your problem.

4
  • 2
    I wouldn't use hash bang crawling. This is already deprecated and Google is likely to fully drop support for it soon. Mar 12, 2018 at 14:09
  • I agree I wouldn't use hash-bang URLs either. Where did you get your information about 'Google is likely to fully drop support for it soon'? Google has confirmed as recently as December 2017 that they will render hash-bang URLs?
    – Sandy Lee
    Mar 12, 2018 at 14:18
  • The article you link to says that they are dropping support for the escaped fragment crawling later this year. That will mean that they start treating hash bang URLs just like they treat hash (not bang) URLs now: poorly. Mar 12, 2018 at 15:16
  • Whether they treat hash-bang URLs badly or not in the future is anyone's guess. The point is while the spec. is deprecated and has been for a for a long time now, Google will crawl/render those URLs without a pre-rendered version of the page being supplied. My solution of using Fetch and Render within Search Console is correct.
    – Sandy Lee
    Mar 12, 2018 at 16:08

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.