Share this Page URL
Help

Chapter 4. Managing HTML Documents Locally > Naming Conventions - Pg. 48

Managing HTML Documents Locally 48 Naming Conventions This is by far the biggest stumbling block for HTML students. One of the main culprits is that people who come from a UNIX or Macintosh background, or who started using home computers with the release of Windows 95, are accustomed to using long filenames. These naming structures allow you to call a file just about anything you want--with no specific concern as to length, logic, or con- sistent relationship between a prefix and suffix (also referred to as extension ). The primary problems with naming are · Improperly formed filenames--To allow for global access, filenames must adhere to specific naming formats. · Unclear filenames--Filenames get confusing if you don't create a system that clearly identifies, at least to you, what each file contains. · Names that are too long--There's already enough length to many URLs--don't add to the prob- lem by naming your file with an unreasonably long filename. · Names with no or improper prefixes and suffixes--If you don't use the proper prefix and suffix locally, how will it work on the Internet itself? Get used to the available suffixes and use them. Unable to bring your site up once you've posted it to the Web? You may have incorrectly named your default file, see "Setting the Default Page" in the Troubleshooting section at the end of this chapter. Improperly Formed Filenames To avoid problems with badly formed names, follow these simple rules: · Don't use spaces--Even if you're used to doing this on your Mac, you'll have trouble testing your files locally and running them on the Internet if you have a space in the name. In place of spaces, you can use underscores or dashes. · Don't use any extraneous characters--Stick to letters, numbers, underscores, and dashes. Es- pecially troublesome characters include apostrophes (as in "molly'swebsite"), dollar signs, per- cent signs, pound signs, parenthesis, and so on. · Put the period in the right place--Similarly, you must avoid using a period, or "dot" in any position other than between the prefix and suffix of a filename. · Name your files in all lowercase--Even though at this point you're working locally and this won't trouble your individual computer, it's a good practice to get into early. Many Unix servers still perceive filenames by case, meaning that index.html, INDEX.html, and IndEX.html are three different files! You'll avoid many a future headache by following this simple guideline. Unclear Filenames One of the best ways to stay organized is to give your files understandable names. This becomes especially important when you begin managing many HTML files in a single project. You can always assign a project a two or three-letter code, and then give the filename a logical identifier. This is something I've gotten in the habit of doing on larger sites. For smaller sites, I stick to simple names. The following is a series of filenames from my personal Web site: index.html new.html