{"id":2229,"date":"2020-09-08T01:21:13","date_gmt":"2020-09-08T01:21:13","guid":{"rendered":"http:\/\/endlesshybrids.com\/?p=2229"},"modified":"2020-09-08T01:21:13","modified_gmt":"2020-09-08T01:21:13","slug":"organizing-files-for-static-websites","status":"publish","type":"post","link":"https:\/\/endlesshybrids.com\/web-development\/organizing-files-for-static-websites\/","title":{"rendered":"Organizing files for static websites"},"content":{"rendered":"\n

One of the most common problems that I’ve seen among students is file management. Or, more precisely, the lack of any kind of file management. If you are a student who depends upon the search function for finding files on you computer, then you need to break that habit. Web development depends upon organized file structures.<\/p>\n\n\n\n

When helping a student troubleshoot a problem, I often will ask the student to show me the directory where his files are located. On more than one occasion, the student showed me something like this:<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

No. Please, no. Don’t do that. <\/p>\n\n\n\n

To make your life easier in web development: learn to organize your files.<\/p>\n\n\n\n

Key point<\/h2>\n\n\n\n

A website, at its most basic, is simply a directory of files on a server. <\/p>\n\n\n\n

Simple, right?<\/h2>\n\n\n\n

Consider the incredible simplicity of that concept. On a server, the web server software looks for a designated folder (often called public_html). The files in that folder are the website. <\/p>\n\n\n\n

Developing on your machine<\/h2>\n\n\n\n

As you develop websites on your local machine (i.e., your laptop), you want to organize your files in the same way that you do on the server. Note: I use the terms directory\/subdirectory\/folder\/subfolder interchangeably. They mean the same thing.<\/p>\n\n\n\n

A method for organizing files in web projects<\/h2>\n\n\n\n

Here’s the method that I use for organizing all my web development projects. <\/p>\n\n\n\n

main project directory<\/h3>\n\n\n\n

Identify the main directory in which I’m going to store my projects.<\/strong> Note that I say projects. In this class and throughout your web development career, you will be working on multiple projects (often at the same time). Each project should exist in its own directory. But it’s good to have a main project directory: a directory of directories.<\/p>\n\n\n\n

One place to put the project directory is under your Documents directory. Personally, I don’t ever store much of anything on the hard drive of my computer. I’m always concerned about backups and losing data. I actually use a paid Dropbox account that appears as a networked drive on my computer. The major benefit is that I can access my projects from any computer I work on: my home computer, my office computer, my laptop. <\/p>\n\n\n\n

But for the purposes of this video: I’m going to assume you are using the Documents directory of your laptop. <\/p>\n\n\n\n

Create the main projects directory<\/strong>. You can name the directory anything you like. I use WebDev.<\/p>\n\n\n\n

Important!<\/strong> In naming files and directories for web projects, do not use spaces in those names. <\/p>\n\n\n\n

Project directories<\/h2>\n\n\n\n

You now have a single directory to place all your projects. Remember, put each project in a different directory of the main projects folder. <\/p>\n\n\n\n

Let’s create a project folder<\/strong> called “termProject”. You can name the folder anything you like, as long as you do not use spaces or special characters in the name.<\/p>\n\n\n\n

At this point, you should have something like the following in your Documents directory (or wherever you’re placing your projects). Uh, don’t use the Desktop:<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

In the termProject folder, you want to create some subfolders:<\/p>\n\n\n\n

  • css<\/li>
  • js<\/li>
  • images<\/li><\/ul>\n\n\n\n

    In the termProject folder, you should end up with something like the following:<\/p>\n\n\n\n

    \"\"<\/figure>\n\n\n\n

    The index.html file<\/h2>\n\n\n\n

    By convention, the file representing the default home page of a website is called index.html. That file exists in the top-level of your website folder, i.e., in this case our website folder is termProject. Do not put index.html in a subfolder of termProject. <\/p>\n\n\n\n

    Create an index.html in your termProject folder. (It can be just a blank file with the name index.html.) You should have something like the following:<\/p>\n\n\n\n

    \"\"<\/figure>\n\n\n\n

    Don’t worry about the file size for index.html. The above image says ‘zero bytes’ because the file is empty. As you add contents to the index.html file, then the size will change.<\/p>\n\n\n\n

    There you go! You have the basic structure for organizing files on a website. As you create more html files, you simply add those to the directory. You also, if you want, can create more subdirectories in case you have a lot of html files. Actually, you can create any subdirectory you want to hold different types of files. You can probably guess what type of files go in the css, images, and js subdirectories?<\/p>\n\n\n\n

    Getting a good handle on organizing files for a website is very important for making your life easier.<\/p>\n\n\n\n

    <\/p>\n","protected":false},"excerpt":{"rendered":"

    One of the most common problems that I’ve seen among students is file management. Or, more precisely, the lack of any kind of file management. If you are a student who depends upon the search function for finding files on you computer, then you need to break that habit. Web development depends upon organized file […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[38],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/posts\/2229"}],"collection":[{"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/comments?post=2229"}],"version-history":[{"count":14,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/posts\/2229\/revisions"}],"predecessor-version":[{"id":2248,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/posts\/2229\/revisions\/2248"}],"wp:attachment":[{"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/media?parent=2229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/categories?post=2229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/endlesshybrids.com\/wp-json\/wp\/v2\/tags?post=2229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}