File Organization Issues

Organizing information is the most important task in getting a Web site set up, but there are a number of
technical issues that impact site design as well. Some of these issues include: 


Directory Trees


People store an incredible number of files on computer disks, both hard drives and floppies!  In order to organize these so they're not all
jumbled together, "folders" or "directories" can be set up to put files in logical places. All computers use a hierarchical "tree" pattern for saving files in directories. (It's called a tree, but the "root" is at the top, so it's a very upside-down tree!) 

 

Every disk has a "root directory" containing files and other directories. These subdirectories may contain other files and directories. 

How does this apply to the Web? 

The "root" directory for a Web server is the directory in which that server starts looking for files. It doesn't have to be the root of the disk itself. For example, the Penn State Web "root" URL is at  www.psu.edu  but the root directory of the Web is actually is  /home/httpd/html 

As you have noticed, directories and subdirectories in URLs are separated by forward-slashes / 

In addition, the directory one level up can be represented by two dots .. and the current directory by a single
dot . These can be used in creating links, as we'll see now... 

 

Relative Address Reference versus Absolute Addressing


When you create a link to Web pages outside your site, you need to give the entire URL - for example, 

http://www.psu.edu/dept/cac/prog/xfiles.htm 
(this is an example of an absolute address)

When you are linking within a Web site, this is possible but not desireable. Why would completeness not be good? Because in building and maintaining a Web site, you often have to move the files around. For example:

When you are building the pages, they will be on your own computer, but when they are ready, you will move them to the server.  When your server gets reorganized, or when you move to a new server or domain name, the files will be moved. 

Nobody wants to have to change all the internal site links in all the files, particularly in the first case. So the Web protocols include the ability to handle relative addresses - that is, partial names that can be filled out automatically with a default part. 

 

Tree Depth: Deep vs. Broad


As you plan your Web site and it begins to grow, you need to decide if you want a "deep" directory tree or a "broad" one. 

A deep tree is one in which many of the directories contain other directories, which have directories of their own, and so on. 
A broad tree is one in which the top level directory has many subdirectories, but the second-level directories do not have many subdirectories. 

Each plan has its tradeoffs: 

Deep trees let you set up a relatively small number of files per directory. Small directories are often easier to manage than large ones, but the URL gets longer the deeper you go.  Broad trees end up with fewer directories but more files in each directory. The URLs stay relatively short. But with large numbers of files in each directory, you, as the designer, need to use a systematic file naming pattern so you can find what you want easily. 

 

Handling Images


In a simple Web site, the images are usually kept in the same directory as the HTML files. However, as Web sites grow, it becomes more difficult to keep track of the image files - especially if files from several directories want to refer to the same images. Many Web designers recommend creating a special image directory and putting all images there. 

I have found it generally simpler on my site to keep the images together with the files they are used with. This results in some duplication, but fewer directories.

 

On your Own Computer


In many organizations, one person is in charge of the Web site - or a specific part of it. Since you're reading this, let's assume that person is you! How should you get started with your Web site organization, and how should you maintain it once it's up and running? 

A good, practical way to do this is on your own computer: 

  1. Create a subdirectory on your hard drive which will represent your Web site. I call mine, web (keeps it simple!) 

  2. In your Web directory, create a file called index.htm. This will be your home page. 

  3. If you want to keep images in a separate directory, create a directory called images to keep them in. 

  4. If you need other subdirectories on your Web site, create them on your own disk as well. If you have many, you may find it useful to draw a diagram showing the relationships between them. 

  5. When you are ready to put files on the Web, use your FTP program to create directories and subdirectories with exactly the same names as the ones on your disk - beginning at the level below your main Web directory. Then use the FTP program to transfer files from your disk to the Web server.