dashes in URLs

J

j

My gut reaction is to leave it alone. If it occurs in the middle of
product name, you'd get sensible-looking URLs. For a product called
"foo-bar":


Lets say we have a product called Foo Bar, and another called Foo-Bar.

If you replace a space with a "-" when you make the URL, then both wind
up as Foo-Bar.

Although that is unlikely, it becomes impossible to tell whether
/product/Foo-Bar

refers to Foo Bar or Foo-Bar

As it turns out there are other characters that are common in product
names that raise havoc in URLs. "/" and "&" being the worst.

There seems to be some standardization toward using a dash as the word
separator, Google encourages it. For those of us who have been writing
html for some time, there is an appreciation for standards, even defacto
standards.

Curiously some of the cargo cult complainers also complained about not
having a Doc Type back in the days (90's or so) when Doc Types had no
impact on page rendering.

Even for someone like myself who has no natural tendencies to follow the
heard, I see the value in using a "-". Google (and the other search
engines) have changed the way they rank pages more than once.

Jeff
 
G

Gene Wirchenko

[snip]
Lets say we have a product called Foo Bar, and another called Foo-Bar.

If you replace a space with a "-" when you make the URL, then both wind
up as Foo-Bar.

Although that is unlikely, it becomes impossible to tell whether
/product/Foo-Bar

refers to Foo Bar or Foo-Bar

You already have confusion in the two products' names. I would
rename one or both.

[snip]

Sincerely,

Gene Wirchenko
 
J

Jukka K. Korpela

[snip]
Lets say we have a product called Foo Bar, and another called Foo-Bar.

If you replace a space with a "-" when you make the URL, then both wind
up as Foo-Bar.

Although that is unlikely, it becomes impossible to tell whether
/product/Foo-Bar

refers to Foo Bar or Foo-Bar

You already have confusion in the two products' names. I would
rename one or both.

Indeed. And if such clashes occur, you can solve them as they come. It's
not the end of the world if you use URLs with parts like "foo-bar2".

But if you really must have a scheme for cases that have not been
detected and will not be detected - or should be signalled to the Naming
Department instead of some arbitrary URL disambiguation - then you can
turn Foo-Bar to foo--bar. Or Foo--Bar, if you have mixed case, for no
good reason.
 
G

Gene Wirchenko

[snip]
Lets say we have a product called Foo Bar, and another called Foo-Bar.

If you replace a space with a "-" when you make the URL, then both wind
up as Foo-Bar.

Although that is unlikely, it becomes impossible to tell whether
/product/Foo-Bar

refers to Foo Bar or Foo-Bar

You already have confusion in the two products' names. I would
rename one or both.

Indeed. And if such clashes occur, you can solve them as they come. It's
not the end of the world if you use URLs with parts like "foo-bar2".

Marketing would prefer "new-and-improved-foo-bar".
But if you really must have a scheme for cases that have not been
detected and will not be detected - or should be signalled to the Naming
Department instead of some arbitrary URL disambiguation - then you can
turn Foo-Bar to foo--bar. Or Foo--Bar, if you have mixed case, for no
good reason.

It is a tempest in a chamberpot.

Sincerely,

Gene Wirchenko
 
J

j

[snip]
Lets say we have a product called Foo Bar, and another called Foo-Bar.

If you replace a space with a "-" when you make the URL, then both wind
up as Foo-Bar.

Although that is unlikely, it becomes impossible to tell whether
/product/Foo-Bar

refers to Foo Bar or Foo-Bar

You already have confusion in the two products' names. I would
rename one or both.

You snipped the relevant part:

Although that is unlikely, it becomes impossible to tell whether
/product/Foo-Bar refers to Foo Bar or Foo-Bar

And that would be true for any URL with a dash in it. Is it really a
dash, or is it a space? The dash is ambiguous as it could mean either.

Product names are generally plain names and aren't stored encrypted:
Red Dog Collar is stored in the DB as such and not as Red-Dog-Collar.
You put product names in the URL as it adds more information than either
the sku or a numeric identifier would.

When you write software you have to anticipate as many problems as
possible. Anything can happen. Dashes are rare, but not unknown.

Jeff
[snip]

Sincerely,

Gene Wirchenko
 
G

Gene Wirchenko

[snip]
Lets say we have a product called Foo Bar, and another called Foo-Bar.

If you replace a space with a "-" when you make the URL, then both wind
up as Foo-Bar.

Although that is unlikely, it becomes impossible to tell whether
/product/Foo-Bar

refers to Foo Bar or Foo-Bar

... is right above.
You snipped the relevant part:

Although that is unlikely, it becomes impossible to tell whether
/product/Foo-Bar refers to Foo Bar or Foo-Bar

What you claim I snipped ...
And that would be true for any URL with a dash in it. Is it really a
dash, or is it a space? The dash is ambiguous as it could mean either.

If you design your naming convention that way, then yes, you have
a potential ambiguity. If that is an issue for you, then do not do
that.
Product names are generally plain names and aren't stored encrypted:
Red Dog Collar is stored in the DB as such and not as Red-Dog-Collar.
You put product names in the URL as it adds more information than either
the sku or a numeric identifier would.

When you write software you have to anticipate as many problems as
possible. Anything can happen. Dashes are rare, but not unknown.

No kidding. I get the idea that it really does not matter what
anyone posts. You will just do whatever you want.

Sincerely,

Gene Wirchenko
 
G

Gene Wirchenko

[snip]
Here's a page name that not everyone has:

cf964dec3fba091be1e0f4d6d0668411.html

Yeah, I've got it on my site. Not for the general public, however.

One humour site that I used to go to and which no longer exists
was thegoodnamesweretaken.com (or something close).

Sincerelyk,

Gene Wirchenko
 
C

Captain Paralytic

In message said:
On Wed, 16 Jan 2013 13:22:55 +0000 (UTC), Lewis
[snip]
Because -'s are word boundaries and _'s are not.
     Huh?
     In "co-ordinate", "-" is not a word boundary.  "_" is often used
for emphasis, like this: _like this_.  Can you show me a *word* that
contains "_"?
That's nice. We're not talking about English, we are talking abut parsing URLS.

     Yes, I read the posts.  URLs often have words in them, English
words.
"This_is_one_word" to a computer, "this-is-not-one-word" to a computer.

     It depends on the language.  For example, hyphens can be part of
variable names in COBOL as can underlines.

Underlines (or underscores) CANNOT be part of variable names in COBOL.
From:
http://publib.boulder.ibm.com/infoc...gg.doc/topics/gegl_cobol_aliascobolnames.html
A COBOL name begins with a letter and is composed of one to 30
characters from the following set: letters A-Z, digits 0-9, and the
hyphen or minus sign (-).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,073
Messages
2,570,539
Members
47,197
Latest member
NDTShavonn

Latest Threads

Top