I'm building an application to allow technical people to enter configuration changes. I'd like to add tags to each change.
Right now I'm using spaces, commas and semicolons. It appears SO uses spaces and requires hyphens to make multiple words. I read something that leads me to believe that WordPress uses commas and that a space isn't a separator.
Is there any best practice out there? Has anyone had any good or bad experiences?
Answer
I think of the StackOverflow tagging method as being good for programmers. I mean, it's kind of unnatural, but there are technical advantages. And programmers are used to all sorts of weird things in place of spaces.
The -
in the tags is technically convenient for a couple reasons:
- The
-
can be used in the URL neatly and reliably shared by email (email programs are notorious for screwing up unformatted URLs). Technically a space would be url-encoded as a+
or a%20
. However, Google will also interpret dashes as spaces and that's what matters. - In StackExchange you can actually search for tags in the search box and when they have a
-
in them, the search engine is able to infer that you're looking for tags.
For those reasons and more I've copied their method for two of my own sites (also relating to programmers).
With all that said, for any other crowd I would lean towards the comma as the separator and actually allow spaces in the tags themselves. Obviously spaces are more natural for the user. It does complicate some things behind the scenes however. With this method you should take extra special care with URL encoding. Spaces should be converted to dashes in URL's to prevent misquoted links from going around in emails and such. And because of that, you should probably not allow apple banana
and apple-banana
to coexist in your database.
No comments:
Post a Comment