1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Navagation links through Script - are they spiderable?

Discussion in 'Google Sitemaps' started by Ghalt, Nov 13, 2007.

  1. #1
    Hey folks!

    I have a website that I maintain frequently, so am constantly making changes. I have a structure of Main Categories, with Sub Topics underneath each.

    Rather than have hard-coded links on each page with the Main Categories and relevant links to Sub Topics, I have a simple script that calls an array from another document.

    I'll paste sample code below. If the code is too convoluted and you need to see an actual site, just ask, but I didn't want this to be a spam to link my site.

    My questions are:

    1. Does the google-bot spider all those links, or can it not really see the links?

    2. Will a sitemap be the right solution to work around if it can't spider the pages?

    I did search through the forums and couldn't find anything that would answer this, so I'm hoping you can help. (the thread showthread.php?t=28342 came close to answering, and seemed to indicate that Google will, but I wanted to give the specific example of my code to double-check.)

    Thanks!

    Sample code (fictional site/content to protect the innocent):



    <tr>
    <td bgcolor="#ffffff" class="subscriberNav"><font color = "#000000" size="2"><u>Main Categories</u></font>
    <!-- Call method in navigation.js to build navigation -->
    <script language="javascript">BuildNavigation(navArrayMain);</script>


    </td></tr>
    <tr>
    <td bgcolor="#ffffff" class="subscriberNav"><font color = "#000000" size="2"><u>Sub Topic - Overview</u></font>
    <!-- Call method in navigation.js to build navigation -->
    <script language="javascript">BuildNavigation(navArrayAlligator);</script>


    </td>
    </tr>
    </table>


    and the naviagation.js file has info like:

    var navArrayMain = new Array();
    navArrayMain.push(LinkObject("Main Page", "http://blahblahblah.com/index.htm"));
    navArrayMain.push(LinkObject("Overview", "http://blahblahblah.com/overview.htm"));
    navArrayMain.push(LinkObject("Alligators", "http://blahblahblah.com/alligators.htm"));
    navArrayMain.push(LinkObject("Crocodiles", "http://blahblahblah.com/crocodiles.htm"));

    var navArrayAlligator = new Array();
    navArrayAlligator.push(LinkObject("Teeth", "http://blahblahblah.com/al_teeth.htm"));
    navArrayAlligator.push(LinkObject("Skin", "http://blahblahblah.com/al_skin.htm"));
    navArrayAlligator.push(LinkObject("Habitat", "http://blahblahblah.com/al_habitat.htm"));




    and

    function LinkObject(pName, pUrl)
    {
    var obj = { name: pName, url: pUrl };
    return obj;
    }

    function BuildNavigation(pArray)
    {
    document.write("<ul class='navList'>");
    for (var idx in pArray)
    {
    document.write("<li><a href='" + pArray[idx].url + "'>" + pArray[idx].name + "</a></li>");
    }
    document.write("</ul>");
    }
     
    Ghalt, Nov 13, 2007 IP
  2. vpguy

    vpguy Guest

    Messages:
    275
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Google won't index links that are added dynamically by script.

    Create an XML sitemap and an HTML sitemap. Link to the HTML sitemap from at least your home page. Have links to all other pages in both your XML and HTML sitemaps to ensure that the pages are visible to the spiders.
     
    vpguy, Nov 14, 2007 IP
  3. websitetools

    websitetools Well-Known Member

    Messages:
    1,513
    Likes Received:
    25
    Best Answers:
    4
    Trophy Points:
    170
    #3
    If you enable scanning for links in javascript code my sitemap generator should be able to find the links so you can create your HTML and XML sitemap. (At least if the links are like what you describe. Anyways. I suggest you try first, if it does not work, please contact me with website url)

    I don't know about Google. Generally speaking, it requires some guesswork to retrieve links from Javascript code. I highly recommend you change to HTML based navigation (perhaps add Javascript on top of it) - check this article about common website crawling problems.
     
    websitetools, Nov 14, 2007 IP