Question

I'm constructing a site with tutorials and other things. I'm trying to find a good URL structure. However, I have a conflict:

tutorials/ <-- list of all tutorials
tutorials/a-very-cool-tutorial <-- points to the very cool tutorial
tutorials/java <-- a list of tutorials tagged java
tutorials/java+soap <-- a list of tutorials tagged java and soap
tools/soap <-- soap tools
tools/wsdl-generator <-- points to the tool
resources/foo <-- resources for a foo
resources/foo+bar <!-- resource for a foo and a bar
tutorials/java?sort=newest
tutorials/php?showhidden=yes&count=30

It's impossible to resolve the difference automatically, so one of them has to be changed. Which one should I do

tutorials/show/a-very-cool-tutorial
   VS
tutorials/list/java
or list-of-tutorials or something like that?

I'm inclined to go with tutorials/list/ (and redirecting tutorials/ to that too)

Was it helpful?

Solution

What's wrong with this?

tutorials/ <-- list of all tutorials
tutorials/a-very-cool-tutorial <-- points to the very cool tutorial
tutorials/tags/java <-- a list of tutorials tagged java
tutorials/tags/java+soap <-- a list of tutorials tagged java and soap

Seems much more intuitive to me, and avoids any ambiguity.

OTHER TIPS

Why don't you express the article hierarchy in the URL structure? You can write:

tutorials/ ← list of all tutorials
tutorials/java ← a list of java tutorials
tutorials/java/a-very-cool-tutorial ← points to the very cool tutorial

This way the visitor can tell that A very cool tutorial is a Java tutorial, and if you mind SEO, this version is good for that, too.

Edit

According to your comment, an article may have several tags, and your site has listings of articles that belongs to a tag set. In this case, you can choose this concept:

tutorials/
tutorials/a-very-cool-tutorial
tags/java ← tags have a separate prefix
tags/java+soap

Or another:

tutorials/
tutorials/a-very-cool-tutorial.html
tutorials/java/
tutorials/java+soap/ ← the trailing slash indicates that it's a listing

(And you can write a third one which may better or not.) It's the matter of your taste.

In addition to the scheme you choose, I suggest you to put the article ID or the publication date in the URL to avoid URL collision.

tutorials/20090509/a-very-cool-tutorial ← a visitor friendly way
tutorials/928/a-very-cool-tutorial ← ID in URL like how Stack Overflow does

Edit 2

Your latest update on the question clarified that aside from the tags, you both have something like categories—I mean tutorials, tools, resources. It gives an unnecessary complexity to the problem. I think it'd be better to handle these extra aspects as tags, too. So tutorial is just another tag like java, and this works with all of the ideas described above.

/a-very-cool-tutorial ← article (beware of URL collision)
/java/ ← all Java posts
/tutorials+java+soap/ ← all Java related SOAP tutorials
/tags/tutorials+soap/ ← you can use an extra prefix

It's not 'impossible'. You can always have a method of checking if the last item in the path is a group or an item and act accordingly - passing control to the relevant code. I have used this technique before on a shopping site.

As the number of items is generally larger than the number of groups, I'd suggest checking if you are dealing with a group as a special case and fall back on item by default.

That's not to say that having an extra parameter in the URL is wrong, better or worse. But you can do it the way you originally stated.

Why not

tutorials/ <-- all tutorials

tutorials/java <-- all Java tutorials

tutorial/a-very-cool-tutorial <-- the very cool tutorial

thus distinguishing between individual tutorials and lists of tutorials by using singular/plural. This removes any possibility of ambiguity, which may give you some sense of security :-)

tutorials/by-tag/java
tutorials/search/user-search-string
tutorials/   <-- all
tutorials/a-nice-tutorial

When parsing the url, you can look for these keywords. If it's unknown, it's a variable index passes to the parent 'resource' to resolve (The tutorials collection gets "/a-nice-tut", a search object is passed the searchstring, etc).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top