Site Files Structure (aka Site Files Hierarchy)

How Web Sites are Structured

All the "site assets" for a web site (any html pages, images, other site content) must be saved into the site's root folder. That is because "references to external files" need to know where those files reside, and they all need to reside in the site's root folder. That way, you can create hyperlinks or display images using a pathname.

Inside the site's root folder, web sites need "subdirectories" to organize the site assets. We will be discussing how to do this properly as we learn more about the kinds of files that will be part of our web sites. Websites are "hierarchical" structures. If your website has more than one page, it will have one or more "subdirectories" for the other pages of the site. The number of subdirectories you have depends on the breadth, depth and complexity of the site you are building.

The hierarchical structure of your site often mirrors the structure of your primary site navigation. However, if you are building a "small" site, you don't have to create a site structure that is as complex as your navigation.

For Small Sites

Many of the sites that we write are "small" sites; they have limited content, and don't dig deeply into that content. When you have a small site, you do not need a separate subdirectory for each topic in your site. The screen shot of a "small" pets site shows how you can organize a small site into one nested subdirectory in the site's root folder:

site structure of small site
Screen shot of a "small" site's site file hierarchy with one subdirectory.

Features of a small site's organization:

While the site will have navigation for each pet (dogs, cats, fish, rabbits, birds), the site structure only needs the pages subdirectory, because there is only one page for each animal.

For Larger Sites

If you create a larger, more complex site, your site files hierarchy needs to accommodate that with a series of subdirectories to organize the information. The screenshote below illustrates a different approach to a pets site, one which focuses on fewer pets, but each pet gets greater depth of information:

site structure of large site
Screen shot of a "large" site's site file hierarchy with subdirectories for each category of content.

Features of a large site's organization:

The site will have navigation for each pet (dogs, cats, fish), and the site's file structure mirrors the navigation with separate subdirectories for each pet.

Why does our exercise have only one page in most of the subdirectories?

This site has more subdirectory organization than you would normally use because I want you to learn how to write links from different subdirectories. If a project site only had one page per subdirectory, it would be "over-structured" and I would ask that you restructure it to properly reflect the site's contents.

When you create your own sites, consider the most effective and appropriate site files structure for each site. The structure you choose will depend on the content of the site in question.