Photoshop Tutorials, Flash Tutorials, 3Ds Studio Max Tutorials, Web Design Tutorials |
![]() |
|
:: Free Website Templates
Optimizing Your Web Site for the Search Engines Using CSS and
Javascript
Michael L. White Copyright © 2003-2004 All Rights Reserved.
Two of the greatest techniques to come along for web site
refinement are cascading style sheets (CSS) and javascript
navigational menus. In this article, I want to show you how to
use both of these to ease the strain of site maintenance while
defending against at least two problems with using javascript
menus.
CSS can make web site maintenance much easier by consolidating a site's style and appearance attributes into one central file which can be edited alone and yet affect the look of the entire site. Just as wonderful, one javascript file can accomplish a similar effect with your site's navigational menu by making it available to every page on your site through a single line of code per page linking that page to the javascript file. By removing all this CSS style and javascript code into two separate files, you will clean up your web pages' textual content, thus making it easier for search engine spiders to crawl and index your site and more effectively rank it according to your actual textual content. These are definitely two techniques worth implementing. Here are the examples to show you how this is done. First, here's how your web page incorporating both the CSS and the navigational menu javascript file should look: <TT> <HTML> <BR> <HEAD> <BR> <TITLE>Your Page Name</TITLE> <BR> <LINK TYPE="text/css" MEDIA="Screen" REL="stylesheet" HREF="http://www.yourdomain.com/your_css_file.css"> <BR> </HEAD> <BR> <BODY> <BR> <DIV ID="center"> <BR> <H1>Your Page Name</H1> <BR> Your page's textual content goes here.... </DIV> <BR> <DIV ID="left"> <BR> Your navigational menu is inserted here from your javascript file using the following line of code. See the next example for sample code for the navigational menu javascript file. <BR> <SCRIPT LANGUAGE="javascript" TYPE="text/javascript" SRC="http://www.yourdomain.com/your_nav_menu_file.js"> </SCRIPT> <BR> </DIV> <BR> </BODY> <BR> </HTML> </TT> <BR><BR> Now, here's how your navigational menu javascript file should look: <BR><BR> <TT> <!-- <BR> document.write('<a href="http://www.yourdomain.com/your_web_file1.html">Page One</a>'); <BR> <BR> document.write('<a href="http://www.yourdomain.com/your_web_file2.html">Page Two</a>'); <BR> <BR> --> <BR> You can add as many menu items as you need, so you get the picture. </TT> <BR><BR> Finally, here's the part of the code in your CSS file which gives your site the table-like look without the high-maintenance, cluttered effect of the HTML TABLE code: <BR><BR> <TT> ...other CSS code, such as font style, etc., can precede the following segment. <BR><BR> The #left and #center blocks of code below correspond to the left and center columns on your web page. You can also add a #right and #top column and section, respectively, if you so desire. <BR><BR> #left <BR> { position: absolute; <BR> top: 0px; <BR> left: 0px; <BR> width: 220px; <BR> padding: 10px; <BR> margin: 5px; <BR> background-color: #f2f2f2; <BR> } <BR><BR> #center <BR> { top: 0px; <BR> margin-left: 230px; <BR> padding: 10px; <BR> } </TT> Hopefully, those examples give you a fairly good idea of the benefit of using these two powerful practices. For more about using CSS, I can recommend downloading the <a href="http://www.sitepoint.com/books/css1/"> sample chapters</a> from Dan Shafer's book, <I>HTML Utopia: Designing Without Tables Using CSS</I>, at SitePoint.com. <BR><BR> Besides these two optimization techniques, however, we're also hearing about all kinds of ways to optimize our web sites for the search engines these days. The competition for those coveted top placements is fierce, for sure. We've heard all about how important it is to have good, pertinent content in the textual portion of our pages, how effective it can be to include our site's keywords within the alternate attributes (i.e, ALT="keyword") of our image tags, and how valuable a link to/from a high traffic, like-minded web site can be. All this is certainly true and well worth the effort to make our web pages rank higher in the search engines, but with all this improvement to web site maintenance, what is the downside? Well, take note, so you can say you saw it here first. <BR><BR> I've detected two pesky problems in this web page wonderland. One is the absence of navigational links for search engine spiders to follow, and the other is the possibility of javascript-disabled web browsers. That's right; as fabulous as it is to store our navigational menu in one javascript file for easier updating, it removes all the key links from our start page so the search engine spiders have no other pages left to index on our site, and javascript-disabled web browsers can't see a menu at all! What's a webmaster to do? Well, here's how I decided to handle it. <BR><BR> I put my navigational menu with its various links to all my site's other pages on two key pages: the start page and the site map page. This way, when the search engine spiders come calling, they can follow every link from my navigational menu to every other page on my site, and, at least, javascript-disabled web browsers will still have a menu to follow. The same is true of my site map page. For all the rest of my pages, however, I decided to leave intact the line of code calling the javascript file containing my navigational menu in order to take advantage of its centralization benefits. The more pages I add to my site over time, the more beneficial this approach will be, too. I see it as having the best of both worlds: easy site maintenance and search engine optimization. So, if you want to lighten your web site maintenance load while keeping your site optimized for the search engines, I recommend using CSS to consolidate your site's style attributes, to include a tableless, yet table-like, appearance and the centralization of a single javascript file containing your navigational menu. Just don't remove your navigational links from your start and site map pages. You can visit either of my two web sites at <a href="http://webmarketersguide.com" target="_new"> http://webmarketersguide.com</a> or <a href="http://www.parsonplace.com" target="_new"> http://www.parsonplace.com</a> to see how I've done this. You're welcome to email me anytime at info@parsonplace.com with any questions or comments. About the author:
|
|
||||||||||||||||||||||||||||||||
Premium Partners |
| Free Website Templates - Flash templates, Affordable Website Design, Website Templates, Website Redesign, Custom Website Design, Web Design Tutorials, Flash Tutorials, Promotion Tutorials - that is what we do. Metamorphosis Design Studio offers quality, free and low cost web site templates for your business and personal life, we also offer affordable web design and site re-design. |
| Vertex Website Tempales - It saves tones of time and money to use pre-made web designs to build your web site. You need a web site but you don't want to pay thousands dollars to professional web design companies? Our web templates is just for you! They are designed to be easilly edited by your favorite html editor, like MS FrontPage |
| Photoshop Tutorials - Learn how to build stunning web pages using Adobe Photoshop, Macromedia Flash MX and 3D Studio Max software. The step-by-step approach makes it so easy, that even beginners can produce great web pages. Get started with these tutorials covering everything from page layout to content tips. |
Free website templates and paid web templates are great tools to make your websites look perfect! You will save time and money with our flash templates and free website templates
Our visitors are satisfied with the quality of our free and paid website templates! Please visit our free website templates and paid website templates sections. We offer free web templates, free web layouts, free web page templates and other stuff for free download. All templates come with the html and external css file so you may easily edit HTML with your favorite HTML editor. Feel free to download our free web templates for your personal websites. Terms of use depend upon the website template vendor. |
| Home | Submit Tutorial | Top Sites | Free Templates | Website Templates | Privacy Policy | Contact Us |
| All Right Reserved by WebDesignTutorials.net |