Forum Moderators: Robert Charlton & goodroi

Message Too Old, No Replies

It looks like Googlebot reads my external JS file

         

omegaman66

10:23 pm on Dec 29, 2011 (gmt 0)

10+ Year Member



I didn't think google bot could read links I have in an external JS file but apparently it can.

First the JS file details. It is a menu that I want spidered. It only contains html that is printed/called via the document.write'(html here)'; code.

This code is in a javascript file only so I can change the code and have the menu change throughout the website.

So back to the issue/question. I just discovered in google webmaster tools the internal link section and it APPEARS that the menu is being read because I show all the pages on the website linking back to the web pages in the menu (menu.JS).

Is this right? Are is something else going on that is tricking me into thinking that the menu is being read?

lucy24

12:36 am on Dec 30, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



There are several recent posts about the googlebot's new-found interest in .js files. In my case I've recently had to 403 it out of the /piwik directory, where it's been following a link that exists only in javascript.

g1smd

1:34 am on Dec 30, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Menu building in general has moved on to using plain HTML for the links and anchor text, CSS to style it and optionally a bit of javascript to animate the movement. I've not see HTML written out by document.write in many a year now.

omegaman66

4:46 am on Dec 30, 2011 (gmt 0)

10+ Year Member



I have had this website for a very long time and taught myself as I went. PHP would have been had I gone with that originally but that was way over my head at the time. Now I am stuck with most of my pages in html when I really need the ability to use the "include" option that php offers.

But hopefully this spidering of the content of my menu will allow me to keep the simply JS file throughout the site.

tedster

5:01 am on Dec 30, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



omegaman66 - on Apache you can keep the .html extension and still parse any php code within the source. See Parsing HTML as PHP [webmasterworld.com]

Best of both worlds!

lucy24

6:01 am on Dec 30, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've not see HTML written out by document.write in many a year now.

Ah, so you're not one of the people snooping around my site then ;) (Slight exaggeration. I use it in selected locations, not universally.)

Wouldn't be much point in picking up an external .js file-- which googlebot definitely does-- if you can't read it.

omegaman66

12:06 am on Jan 1, 2012 (gmt 0)

10+ Year Member



I am aware of the html parsing option but have desided against it. That would add overhead to the server and slightly slow down the page load speed.

And I just prefer to keep things simple. I just don't like work arounds like that sometimes. Maybe I should consider it.

tangor

1:34 am on Jan 1, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Keep it even more simple. Check out server side includes (SSI)... Given today's machines, gzip, etc. there's not a gnat's whisker difference in "speed" in using them.

omegaman66

2:34 am on Jan 1, 2012 (gmt 0)

10+ Year Member



But SSI would require the urls #*$!x.html to #*$!x.shtml correct?

tangor

4:04 pm on Jan 1, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



same parser used... the default is shtml... but can be parsed to include htm html...

rainborick

4:10 pm on Jan 1, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



In your .htaccess file, add:

AddHandler server-parsed .html .htm

and your current HTML files will be parsed for Server Side Includes.