What is best practice when naming files in your website management? Why is consistency in file naming important? In this interview Reece Lamshed talks with John Parnell Pierce about naming conventions for website files.
Note: This interview is 6 years old. It was part of a training resource for beginner interactive media students. Though web technology has changed, the principles discussed are still relevant.
- Use file names that make sense.
- Be consistent with your naming.
- Limit names to letters, numbers, dash and underscore.
- Don’t use ?, #,$,+,/,: and % as these characters have specific meaning in web addresses.
- Traditionally the 8,3 naming convention was a good practice.
REECE: Let’s talk about the naming part here John because, as you are indicating there, going back to our URL, the folder name, image name, or the HTML name is going to be reflected back in our URL. What are the conventions there with naming files?
JOHN: Well you should try and make the naming descriptive, but not overly large either.
REECE: So that if there’s photograph of the dog is called dog. And not have a number system, that is the other way some people go, and they get up to 0.11111 you know and so on or 1.02 dot whatever, and again when you go back to try and find your dog image, you can’t find it because you have forgotten what you have named it.
JOHN: You know know what it is.
JOHN: Look there’s a couple of schools of thought here too. Some people do like to deliberately obscure their contents, so that by using numbers or random letters, they create a website that is actually difficult for another developer to go in and track through it, and work out what they’ve done. You know it’s probably a good way to actually preserve a contract for designer if he doesn’t want another person coming in. However, if you’re consistent with your naming and if you do have a descriptive names, it also allows your users to make guesses on where the content might be located. So that if you’ve got a folder called ‘dog’ which only has dog information in, and the person knows that part of the site’s about cats. If they know they’ll do /cat and they actually find what they are looking for, it’s a shortcut that helps the user use the site. It also makes it easier for you to work and edit the site yourself, if you’ve used a convention that works.
The other thing with naming are that you should avoid trying to use strange characters from the keyboard in the names. Essentially you should really only be using the letters of the alphabet, the numbers, you know these numbers 0-9, dash and underscore. If you’re using question marks and exclamation marks, equal signs, and pluses, then there’s a good chance that those files what work when uploaded to the web server. Question mark, for example, has a very specific meaning in URLs. The question mark usually indicates that there is data following the URL, which is going to be read by the server. So does the plus sign. The plus sign is also a part of the data string. So you should stick to letters, numbers, underscore, dash. You should make sure you have a file extension.