dashes vs. underscores in filenames
Some material is very old and may be incorrect today
© December 2005 Tony Lawrence
In the old days of the web, file names usually didn't go out of their way to convey information about their contents. If the page was about dogs, sure, it might have been "dogs.html", but if it was "Care and feeding of poodles", it was more likely to be "poodles.html" than anything else.
That's all changed. The conventional wisdom nowadays is that search engines pay attention to file names as part of their analysis, so that poodle page is probably "care-and-feeding-of-poodles.html" now.
That brings up a question, though: should it be "care-and-feeding-of-poodles.html" (dashes) or "care_and_feeding_of_poodles.html" (underscores)? A Google search for "dashes vs. underscores" will tell you that dashes are the smart choice, but I didn't find any place that tells you why.
One hint might be found in Perl regular expressions. If you use "/w" in a Perl expression, that matches alphanumeric characters plus "_". The "/w" is often used to break up sentences into words. So "hello-there" is two words if "/w" is used, but "hello_there" is only one. I'm not saying Google or any other search engine uses Perl to parse your pages (though they might), but Perl got the idea of "_" being part of a word from long established practice. So, if you want search engines to "see" separate words, you should probably use dashes.
There is another point to consider, though: "care-and-feeding-of-poodles.html" is a lot of typing, and although most passing of links is down by cut and paste rather than word of mouth, length and difficulty may be something to think about. I think I'd probably make that "poodle-care.html". There is also speculation that search engines may penalize you for too many dashes in a link because it starts looking like spam: "lets-cram-every-keyword-we-can-into-this-link.html".
So, use dashes and keep it shorter rather than longer.
Got something to add? Send me email.
(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version
Inexpensive and informative Apple related e-books:
Take Control of Numbers
Take Control of the Mac Command Line with Terminal, Second Edition
Sierra: A Take Control Crash Course
Digital Sharing Crash Course
Take Control of iCloud, Fifth Edition
More Articles by Tony Lawrence © 2009-11-07 Tony Lawrence