Poll: Which do you prefer for word separation in filenames or directories?
Thursday September 24, 2009
What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >
Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >
©2009 About.com, a part of The New York Times Company.
All rights reserved.
While spaces in filenames can be an issue to poorly designed backend software, they are quite well handled by any modern browser. Let’s face it, other characters are used only because of lazy people
I mean “because of lazy people”, not “by lazy people”.
The hyphen. From my (rather generalized) understanding of SEO, many search engines treat words separated by underscores equivalent to single compound words. So searching for “Mariners” might not hit on a file named “MLB_Mariners_2009_schedule.pdf”.
By using the hyphen, you circumvent that issue, encouraging better SEO results.
Alex, I never heard that about search engines and the underline character. Though, I often use underline character for includes, data table names, etc. I prefer to use camel case for my web files or all lowercase. I never use spaces on any file names, they cause too much problems with conversion software.
I always use hyphens these days, although SEO wise hyphens are technically better than underscores you can still get the same results with underscores.
Google did say that they were going to treat underscores just like hyphens (as word separators) However, I think I remember Matt Cutts saying they havn’t done that yet for some reason.
JP
Underscores are soooo last season.
Hyphenation is where it’s at!
myFavoriteWayIsWithUseOfUppercase_but_sometimes_underscoring_usually_if_there_is_a_date_like_100309.jpg
Used to rely on underscores, now I’m using hyphens.
To tell you the truth, i don’t really have a preference. mod_rewrite hides it from both me and my users anyway…
Perhaps we should never have been allowed to use spaces in filenames at all; either that or the command interpreter should have used something other than space to separate the command from the argument list.
Hyphens, hyphens, hyphens …always have, always will. Never have understood the inclination towards underscores by so many. As the default for links is underlined, the underscore can be “hidden” and cause confusion. Email addresses with underscores should be banned! Lastly, for those where every key-stroke counts, you don’t need to press your shift key to get a hyphen.
I like CamelCase. It is simple, fewer keystrokes, doesn’t get lost in underlined text, and I hate typing anything that has to use the top row on the keyboard!
Do you know that “,” is much more good to ‘hidden’ files? For example, you can “login,module.php” or even “home,page.html”.
I used to strictly use underscores. More recently, I have switched to using a combination of underscores and hyphens, usually based on what words are being separated.
For example, I will use about_us.html for the name of a file. I have learned to start versioning files; this is where the hyphens come in:
about_us-v1.html or about_us_09-30-2009.html
At work, I often screenshot images or have to copy date- and/or time-sensitive data into a file. For these, I will separate the date and time with an underscore and use hyphens to separate the MM/DD/YYYY and HH:MM. For example:
09-30-2009_13-12hrs.txt
(I’ve learned to specify hrs in the filename because not everyone at my workplace understands military time–they’re not all technically oriented.)
Using anything but hyphens is a pet peeve of mine. I will often get hired by a company that is redoing the Web site only to find out that the top management has specified underscores as the standard. Yuck. Underscores aren’t picked up by search engines, and it has been shown that words separated by hyphens are easier to read than those separated by underscores.
I think it somehow goes back to the convention of only allowing underscores, letters, and numbers in names.
The argument against camel case is the same as that against underscores.
It’s good to keep file names as close to the root as possible. Some search engines will stop after going down three levels. So using too many slashes is out.
Spaces cause issues. They are often converted to %20, and then they most be unconverted.
Periods usually denote extensions. For example, if I have an include file that is for the whole site and it includes other JS files, I will name it something like gobal.js.inc The include filename never gets shown in the browser.
I usually use capital letters to separate words in a file name:
Norway09fjordSM Each word starts with an upper or lower case letter depending on what the word preceding it ended with. SM (small) is my code for a picture I have reduced from its original size to 1024 x 768 pixels.