ITSS WebDev Guide
Structuring your site
When setting up your web site in your account's www directory or on your hard drive, you should design the underlying structure with the future in mind as well as your current plans. This means that you should have some meaningful organization to how you store your files on the web server.
When first constructing a web site, most people tend to put all the files into just the www directory. With only a small handful of html files and graphic files, this may not seem like a problem. The problem comes later when your site grows to dozens of web pages with dozens and dozens of other files such as graphics and pdf files. Once your site grows, you soon realize that you have hundreds of files in a single directory and it becomes quite difficult to tell what you have in your www directory. Once you realize this is a problem, it may be quite tedious and time consuming to restructure your site because you will need to change a great deal of HREF tags.
There are several approaches to structuring your site so that it is easily maintained. There are three structures that work well and will be described here. You may think of a better structure that will fit your style better though.
1. Separate the file types
Some people organize their site by what kind of files they have for the site. HTML, Graphic, PDF, CGI, Data, Multimedia etc. are just some of the file types that may be part of a web site. This method would have a directory dedicated to each file type. This is an example of what the contents of the www directory might look like this:
cgi-bin data html index.html movies pdf pics
This structure will help by reducing clutter with its simple grouping scheme. All of the names above are directories except the index.html file. Notice that there is still an index.html file in the www directory. This has two purposes, the first is to keep the URL short such as this:
http://www.server.name/yourdirectory/
vs
http://www.server.name/yourdirectory/html/my_web_site.html
The second purpose is so that people can't use the first URL to see the contents of your www directory.
2. Separate the topics into mini web sites
Some people organize their site into several smaller web sites based on the topic. This is a useful method if you have several topics and very few graphics or other files that are needed for more than one topic. The files that are used in several topics could reside in a special directory in the www directory. Here is an example of what the contents of the www directory might look like:
cgi-bin fossils geology index.html shared volcanoes
This structure will help by grouping the files together with the rest of the files related to that topic. In this example, the shared directory would contain files used by more than one topic such as a footer or a background image.
3. Combine the first two methods
One of the best ways to structure a web site is to use a combination of the first two methods. Divide your site by topic and then divide the individual topics into file types. You can further divide major topics into sub-topics. Here is an example of the geology topic above and one of its sub-topics:
geology: igneous index.html metamorphic sedimentary shared sedimentary: alluvial.html glacial.html index.html pics slump.html
You may notice several things in this example. There is an index.html in each of the directories for the same reasons mentioned in the description of the first structure. This also is a good place to describe each of the sub-topics and link to them. There is a shared directory in the geology directory for shared files specifically related to geology topics. There is a pics directory in the sub-topic sedimentary directory for images pertaining just to that topic. This structure also makes nice URL's:
http://www.server.name/yourdirectory/geology/sedimentary/slump.html
In this example, the URL tells us exactly what the page is about, if slump.html were in the www directory some people may think it was about a dry spell in McGwire's home run hitting streak.
One other technique is to capitalize the first character of directory names. This makes it easy to pick out the directories from the files. Some systems, which are case sensitive such as UNIX, will alphabetically list capitalized letters first and then lower case letters so directories are even easier to see.
Rev: ajm 11.04 xs