Solved

Can Google index Jquery content?

Posted on 2014-01-30
23
1,116 Views
Last Modified: 2014-03-25
i need to update headings and alt tags on a website.

The website is made in drupal and i cant for the life of me figure out how to add alt tags to images. (there is no alt tag fileld on image sliders)

and i dont know where the code is to update the headings in the back end.

i normally use concrete5 as my main CMS so going to drupal is very backwards to me.

i figured i might be able to put some jquery together to update the headings and add alt tags as this will be very quick to do. but will this be ok for google to index?


Example of how i might change the headings.
<h1>this needs to be a heading 2</h1>

        $('h1').replaceWith($('<h2/>').html($('h1').html()));

Open in new window


Example of how i might add alt tags:

// add an alt to this image with the url:

$("img[src*='url-part-here-or-full-url-here']").blarrrr

// if we have any other images without alts we can add alts like this:
$('#map_canvas > img:not([alt])').attr('alt', 'Alternative text');

Open in new window



i found an article saying google uses chrome as its spider and can now interpret ajax calls but am still hesitant.

what do you think?
http://moz.com/blog/just-how-smart-are-search-robots
0
Comment
Question by:helpchrisplz
  • 10
  • 5
  • 4
  • +2
23 Comments
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39820412
In this case, have an alt tag or not on a few images is not going to make or break your rankings.  While I agree seo is about many small parts, I would do this for the users or those that have screen readers.  

To answer your question, if I look at how google has cached some pages I have worked on that use jquery it appears that may be true.  You can test by viewing your own content http://webcache.googleusercontent.com/search?q=cache:http://yourdomain.com/somepage
0
 
LVL 58

Expert Comment

by:Gary
ID: 39820822
Google will index ajax content but it is not guaranteed to be indexed or even used but you should not use it for items like Meta or Title. Google expects it for your content in the way sites are becoming more dynamic, it doesn't expect it for things that should be there to start with.
0
 
LVL 1

Author Comment

by:helpchrisplz
ID: 39820852
Meta or Title is not what i was asking about.
headings and alt tags are the focus of this question.

Unless your on about the same thing? just different terminology.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39820873
Misread it slightly (still waking up) but still the same applies - if it is important to your page it should be there to start with.  Remember Google isn't the only search engine so always work for the lowest common denominator which means no reliance on ajax content.
0
 
LVL 1

Author Comment

by:helpchrisplz
ID: 39820876
jquery .replaceWith isn't the same as ajax but i see what you mean.

i might just have to do a test page to see if it gets indexed or not
0
 
LVL 58

Expert Comment

by:Gary
ID: 39820890
Yeah still dynamic content tho ;o)
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39821603
I agree with Cathal about the lowest common denominator although for any of the sites I work with, Google supplies the lions share of organic  referrals.   It is always good to constantly test everything.    

I think if you don't try and "game" or outsmart the system, you will do good in the long run.  In the end, it is not about an alt tag or meta stuff, it is about your site's content having the ability to naturally attract others to use and reference your site.  When they do come to your site, they stay and share.   The only way for that to happen is to have great content.  There are no short cuts and those that do spend a lot of time generating content will have an easy win in the long run because most people don't have what it takes to generate truly great content and on regular basis.  Those that do, may be start, but quickly loose interest  probably because it is difficult and you don't get instant gratification.  

Best of luck!
0
 
LVL 13

Assisted Solution

by:Arrow_1
Arrow_1 earned 125 total points
ID: 39821643
To add alt tags to images added via Drupal 7's image field, do the following:

Depending on how your site is set up. Many developers will make their sliders using views to display images from a certain content type. If that is the case, then try this:

Via the admin interface, Navigate to Structure >> Content types. Select the content type being used for your slider. You will now be presented with a list of fields used in this content type. Find the image field and click the associated edit button. On the settings page, scroll down until you see the Enable Alt field checkbox and tick it. Save the settings. You should now be able to edit your page and you will see a box for adding an alt tag to your image.
0
 
LVL 1

Author Comment

by:helpchrisplz
ID: 39821664
I've tried that but couldn't see the alt field check box to enable it.

might have to have another look.

not sure why this wouldn't be enabled by default...
0
 
LVL 1

Author Comment

by:helpchrisplz
ID: 39821697
Scott Fell (padas)

i know the drill with content being king but sometimes you end up working on a site that has super boring services! lol.  

for example the last site i was doing was drain cleaning.  i guess writing content works when you have a website that is easy to write for.

i like the get all the onsite changes perfect as i think it drags down the other seo work if its not done to its upmost.
0
 
LVL 29

Expert Comment

by:fibo
ID: 39823683
Hmmm... something important to be aware of is that spiders do NOT run javascript (nor, consequently, ajax) nor Flash, which are usually executed on client-side
They might READ the files and grab there contents such as urls or words... but it would be wise to avoid that.

Sidenote: this implies that if you want your content indexed:
- do not rely on javascript-only or flash-only navigation, since most of the links will NOT be discovered and corresponding pages will NOT be "found" since they will not be sought for
- same applies to your content: consider that javasript-only or flash-only content will be badly indexed, if any!

Coming back to your problem:
- you cannot rely on jquery generated content, they will be readable only on visitors browsers, not in spiders exploration
- BUT you should consider to generate your content with drupal php modules: php is run on the server and generates the html (and/or the javascript) which will be sent to the browser or the spider; since it is "hard-coded html" as far as browsers and spiders are concerned, spiders will be able toi read en index it
- as a stop gap measure if your pictures are not indexd you might consider workarounds such as having a map of all your pictures etc
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 1

Author Comment

by:helpchrisplz
ID: 39825268
"do NOT run javascript "

do you contest the link that i put at the end of my first post?

i know every one has an opinion but please backup you reasoning.  

i think the only way of getting to the bottom of this is to do a test.  by doing the code i suggest on my first post and seeing if it gets indexed.
0
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 125 total points
ID: 39825326
> i guess writing content works when you have a website that is easy to write for.

That is your opportunity.  Everybody else is thinking the same thing.   Razors are pretty boring.  This guy made them not so boring http://www.dollarshaveclub.com/ and the videos were semi viral for a short time.

In any case, you need to test.  I found by looking at my google cached content that jquery was being taken into consideration.   Just don't game the system.  

I don't know drupal but if there is a way you can fix this in the modules, that sounds like the way to go.
0
 
LVL 29

Expert Comment

by:fibo
ID: 39828142
It seems that you ask the question "does Google index Jquery content" and that you have already answered "yes".

For my part, I would play it safe and make the changes not in javascript, but in the modules OR in the content itself (since when you insert pictures you can write additional info that will improve SEO)
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 125 total points
ID: 39828154
Hmmm... something important to be aware of is that spiders do NOT run javascript (nor, consequently, ajax
I'm afraid you are wrong, Googlebot will 'execute' javascript and try and follow any resulting URL's.  This is a PITA as you would sometimes use this to prevent Google indexing content you didn't want indexing.
I've been trying several ways to prevent this happening as it keeps indexing sorting options on a shopping site, options which reload the url based on what was selected and guess what it is js that is reloading the page.
0
 
LVL 1

Author Comment

by:helpchrisplz
ID: 39828165
My opinion is the same: always use server side and not client side for SEO.
i already knew this before asking. :)

i guess i was asking this question to see if there was any proof that can be backed up that google does do what the article mentions as it would make my life easier (when doing onsite changes).

Particularly the .replaceWith and alt jquery code i put in my first post.

I have seen an article saying google does index inline document.write
but thats not much help for my task i would need .replaceWith to accomplish my tasks.

What i think i should do is actually test my theories and make my own article on my findings.
0
 
LVL 29

Accepted Solution

by:
fibo earned 125 total points
ID: 39828286
Cathal: if you browse thru the code of the html page or of the js files, do your sorting options appear as text, eg in the javascript code?
If yes maybe GG is guessing that they are links and follows/indexes the link targets

To draw a conclusion it would probably need to create a single unlinked page A (but which links to another page B on an existing site, otherwise it surely will not be kept by GG as worth indexing) and create another page C where the link to this page A will be totally "synthetic", ie no visible url appears and it needs running js to generate the link-text
Then create as well a page D with a link to it from C.
Assuming that previously neither A nor D exist, and that no link to either A or D exist in any page... watch when D is indexed. If javascript-only links are understood by GG, then A should be indexed within some days of D...
0
 
LVL 1

Author Closing Comment

by:helpchrisplz
ID: 39953102
Every one has there opinion and SEO doesn't have a definitive rule book....
No one knows how the Google spider really works as Google don't tell us the technical info... its all hush hush...

They do, do webmaster vids at http://www.youtube.com/user/GoogleWebmasterHelp
but i don't know how to put this question to them.

I haven't had time to do a test but i put fibo as best answer because he has the best info on how to do such a test.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39954303
If you watch those videos, from 2 years ago march 2012... http://www.youtube.com/watch?v=8yTn_HLDaJs they are saying they are and getting better.... 2years ago.  If you want to be safe, https://developers.google.com/webmasters/ajax-crawling/ but that too was last updated from 2012.

As said few times, you should continue to test.  But also understand what you are testing.  If your getting 500 monthly unique visitors vs 50,000.  When getting a small number of visitors, your results may not be statistically accurate depending on what you are testing.

Anything I am using ajax for on my own sites is not something I am worried about for seo.  I think that is a good plan to stick with.
0
 
LVL 1

Author Comment

by:helpchrisplz
ID: 39954330
jquery .replaceWith(); isn't ajax is it?
0
 
LVL 1

Author Comment

by:helpchrisplz
ID: 39954347
are you saying its the same as using ajax because it happens after the dom is loaded.
From what i've read google can interpret inline jquery.

So in my tests i will try with and without document ready...
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39954397
If you have a page that generates the below html and js via your favorite server side code
<!DOCTYPE html><html><head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script><script>$(function() {$('h2').replaceWith('div'); });</script>
<meta charset="utf-8"><title>hi</title></head><body><h2>Hello World</h2></body></html>

Open in new window


Before the page loads any server side functions are run, then the rendered html is sent to the browser just as if it where hard coded.  Next the javascript is run after the page loads.  The only difference I can think of between doing this and an ajax call to a complex sql is perhaps some lag time before it loads.  

For SEO, I would assume what is sent to the browser is crawled.  In the case of an image slider for instance. Some load all images to the browser at once and others one at a time.  The first way can be slower to load, but all images will probably be indexed.  The 2nd way could be faster to load, but the images may not be indexed together.  

Having a lot of great content is going to be the most important thing you can do out of anything.  So changing an h1 tag to a p tag for whatever reason is not going to make or break your site.

If there are 1000 sites selling the same widgets as you in your area and 750 of them have the similar minimal content, 100 of them have some type of blog they add to because that is what they are told, 100 more also have some social media with their blog because that is what they are told and 50 more have a lot of great content on their site, passionately blog about their subject, and actively engage their users  on social media.... Which group do you think will show up 1st, 2nd, 3rd, 4th in search results?  If you are one of 750 and you are only concerned with alt tags and some ajax, you are already beat by the 50 creating great content and engaging their users (probably went as hiring a professional writer-very few can write).  

While everything together makes a difference, content is what you should be worrying about.
0
 
LVL 1

Author Comment

by:helpchrisplz
ID: 39954428
ye i agree... but every little thing adds up.

h1 h2 and h3 tags are a very good way of telling google what the summary of the pages paragraphs are about.

So i would say its very important.

I want to focus on every little aspect of the SEO to get the best possible outcome.

I was merely wanting to find out more about a question that was bugging me,
I know this question only focuses on one little thing but that was the point. :)
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now