tags:

views:

135

answers:

4

I have a very large cascading menu system with over 300 items in it. (I know it's large but it's a requirement.) Currently, it's written in javascript so the external file is cache by browsers. To improve search engine results I need to convert this to a css menu system. I realize the browsers will also cache external stylesheets but is there a way to cache the menu content (<ul> and <li> tags)? If I use javascript (document.write) to write the content I could have this in an external javascript file, which would be cached locally, but would this be search engine friendly? What is the best solution?

+6  A: 

The best way to accomplish what you want to do is using SiteMaps to inform Google about the urls for your web site. Basically you will want to translate your hierarchial data for the menus into a SiteMap.

Dale Ragan
A: 

@Dale - a site map is a good solution for Google and other search engines will certainly index pages in the site map. But because the menu is displayed on all pages of the site it would be very beneficial to somehow cache it locally. I'm looking for a way to do that.

Geri Langlois
I think if you implement the SiteMaps thing, you would get the search engine friendliness aspect taken care of. And so you can leave your menu in javascript if you are happy with it otherwise.
toby
Toby is correct. Just keep it the way you are doing it. Leaving the menu in javascript like you have it is fine. You don't need to do anything else. That js file is cached by the browser, therefore giving you the functionality. Then use the sitemap to implement Search Engine Optimization(SEO).
Dale Ragan
A: 

You could generate the menus beforehand into static html / javascript files, and have all the pages pull the site from the same URL on your site. That way, the client side browser will do the caching. You'll just have to have a step in your deployment that generates the html files for the menu.

Try to have it generate as much plain HTML (+JS +CSS) as possible, then whatever has to be dynamic can be adjusted with javascript.

Garo Yeriazarian
A: 

You could do the whole thing in CSS and HTML only, and you don't need yo use any Java script. See < http://www.netwiz.com.au/cssmenu.htmlvalue >. This pages shows a tool to be used with a specific documentation software, but the sample CSS and HTML shows how to use ul li elements for a CSS/HTML only menu in a large number of browsers.

You still have the problem of 300 items in the menu which will add to the loading time. If this is an issue I guess you could move this code to a separate iframe to increase the chance of it being cached at a proxy (or by the browser). At the risk of offending the purists even a frame might do the job, but you will have problems with the topic pages not being able to display the menu if they are linked to directly.

David L Morris