File Naming Conventions
The following is the set of conventions that I use in naming files and folders. They reflect my understanding of best practices and help me achieve consistency in my work.
- Use of clear and mnemonic file names.
- Produce a level of consistency in naming that will foster a relatively intuitive access to files and Web space.
- Ease management and maintenance.
- Do not use . / $ ? [ > } < * @ or spaces in names: cm-dedication-01.jpg
NOT cm.dedication/01$.jpg. This is a required convention that can seriously affect functionality.
- Name files with discriptive names: cm-dedication-01.jpg NOT imag-01.jpg
Descriptive names support finding and recognizing a file over time. Give files and folders names that describe their content. For HTML files, this can be accomplished by using a name that is based on the title of the page.
- Keep file and folder names as brief as possible. As a target, make names shorter than 70 characters including the protocol (http://) and extension (.html). This allows a maximum actual name length of 68 characters.
- Use only lower case letters: cm-dedication-01.jpg NOT CM-Dedication-01.jpg
Unix servers are case sensitive, so requesting "winterwheat.html" will not be able to receive a file named "WinterWheat.html" if your site is hosted on Unix. If capitals are used be sure that all links are correctly capitalized, and test all links after uploading files! Also, when linking, use the same capitalization scheme as the files even if your Web server is not case sensitive. Inconsistency could result in broken links if you ever change servers to Unix. Using only lower case letters reduces the chance of coding errors because you don't have to remember what to capitalize and when. In addition, visitors have an easier time if they're trying to type the URL directly into their browsers instead of clicking on a link. Finally, if you choose to use capitals, use them only for the first letter of words.
- Use dashes to separate elements: cm-dedication-01.jpg NOT cm_dedication_01.jpg. This supports search engines seeing the content between dashes as separate recognizable/searchable data. Underscores tie all content into one continuous element. This issue is extensively debated as the resources below indicate. I continue to wonder about this one.
- Start all file names with at least one letter: cm-dedication-01.jpg NOT 01-cm-dedication.jpg.
This produces a list of files in alpahbetical order by descriptive name and supports the first convention.
- Name image files stored within a unique and descriptively named folder with numbers or beginning with numbers to establish sequence. (e.g., 001.jpg, 002.jpg, etc. OR 001-utah.jpg, 002-utah.jpg, etc.
- When numbering a series of files use the appropriate number of leading zeros: 01-utah.jpg to 99-utah.jpg OR 001-utah.jpg to 999-utah.jpg. This will produce the appropaiate listing sequence by the computer.
- All file names should end in the appropriate extension (e.g., jpg, gif, etc.). Use .html for all plain HTML pages.