Web File Naming Conventions
- 20 August, 2011 -
- beg-define, beginner, build -
- Tags :
- 0 Comments
When creating your website, you must be very methodical when naming your files.
First, never use spaces, uppercase letters, or any special characters in your file names. While your site may seem to work okay using an HTML editor (i.e. Dreamweaver) on your local computer, when you upload the website on the server, violating these rules can cause you lots of problems.
For webpage file names, be sure you use “index.html” for your first webpage. Using this special name will tell the server to display this page as the “home” page (default page) for any directory of html files.
Other HTML files should have descriptive names such as products.html or about-us.html, rather than meaningless names such as page1.html. Name your files as if you’re giving the website to someone else to work on, and they won’t be able to ask you any questions about it (for example, you, in 6 months after the project is finished and you can’t remember anything about it!).
- No spaces in the filenames. Use an underscore or a dash instead of a space.
- Most often, use all lowercase letters. Or at the very least, be consistent. Most Web servers are case sensitive so “cat.jpg” is a different file than “Cat.jpg.”
- No special characters in the filenames: For example none of the following are acceptable in web filenames: “!~:&(,
- The files MUST have the proper suffix (.html, .gif, .jpg)
- Be consistent in your naming of files, for example use the same prefix in a series of files. Also, to ensure that the files alphabetize correctly, always “zero-pad” your filenames when they have numbers in them. In other words, if you have a series of files numbered 1-20, the first file should be something like casestudy01.jpg, and the last file should be named casestudy20.jpg.
And again, it’s critical that you name your files correctly from the start. If you attempt to rename your files after you’ve created your site, you will, in all likelihood, break all the links in your webpages.
File names have implications for your Search Engine Optimization (SEO) so name your web files wisely.
Descriptive filenames help you recognize what content the file contains and helps with SEO. Remember the following:
- Use keywords in your filenames
- Use actual, descriptive words (i.e. black_cat.jpg instead of img01.jpg)
- Shorter is better for filenames
Must Read: Beginner’s Guide to SEO: Best Practices