Posted by narres on May 31, 2006 at 6:10pm
Interesting would be a virtualpath.module which would substitute e.g.:
Users:
http://drupaler.net/user/1
to:
http://drupaler.net/user/1/Narres.IT
http://drupaler.net/user/Narres.IT.1.html
Nodes:
http://drupaler.net/node/17
to:
http://drupaler.net/node/17/Some%20links%20to%20relations%20between%20Us...
Categories:
http://drupaler.net/taxonomy/term/5
to:
http://drupaler.net/taxonomy/term/5/Modules
http://drupaler.net/taxonomy/5/Modules
http://drupaler.net/taxonomy/Modules.5
It's easy to do this in a template, but would be much more usable in core or a module.
Comments
Are you familiar with pathauto?
It can automatically rewrite node/user/taxonomy paths in really flexible ways. Are you suggesting something different than what pathauto already does? Please clarify.
Sure Robert, I know it
but what it does is inserting real aliases into the database. So it slows down my sites with a huge amount of nodes.
I thought about doing this without the use of the alias-table (so I called it virtual).
The special version, which is solved in a template works fine for me. Writing a common module makes only sence, if there is a common interest.
4.6? or 4.7?
Aliases are much more efficient in 4.7, so if you were having problems with 4.6 pathauto, it was a bug in Drupal itself.
pathauto performance
I did it in 4.6.x: performance is really much better now in 4.7.x
So you rewrite incoming and outgoing URLs?
How does your templating system work? How do you map incoming aliased URLs to node/x?
In my template I'm only
In my template I'm only using a very simple mechanism:
I only use /node/$nid/$title instead of /node/$nid
this works by default.
Aaaahh.
Now I'm catching on =)
I would only worry that you could introduce paths that squash existing real paths. For example, if the pattern is node/$nid/$title, you'd run into troubles as soon as $title = 'edit'. It isn't really possible to predict which paths you could add onto node/$nid because any module can introduce new ones as the default means of extension. For example, the book module introduces node/$nid/outline. So you'd possibly run into weird behavior when you go to turn on a cool new module and all of a sudden the whole application breaks because of a path conflict.
You are right
my "solution" is not really a solution ;)
To avoid some of these unfortunatly circumstances, I'm using this way of url-representation only if you are not logged in (that is something a spider usually doesn't do).
It's an interesting idea.
I wonder if it is really necessary with the option of pathauto... although it is clear that your solution is very light-weight in comparison. No extra db lookups.
That's what I want to figure out
I introduced this solution nearly 2 years ago on a site which had over 10K nodes. At this time I had no other possibility due to performance restrictions.
The furtune is in most cases the light-weightness.
But there is another reason preventing me from using pathauto. If I decide to use another strategy of "speaking urls" I cannot use the "Bulk generate"-pathauto without destroing my manual set path-aliases.
Maybe I'm wrong but I think this will easy to implement in pathauto to use only symbolic (without use of DB) url rewriting like the i18n function i18n_init() does.
path overhaul for performance
There was some discussion a while back about introducing an alias field to the node table that is the "primary alias" for each node and then using the url_alias table for "secondary aliases". This system has the potential to improve performance in several scenarios and probably hurt it in others. I lost track of the discussion as it headed into the UI differences between a primary alias and a secondary alias - I'm not sure where it is now, probably needs some more coding and a benchmark to show whether there is any merit in the concept.
--
Growing Venture Solutions
Drupal Implementation and Support in Denver, CO
knaddison blog | Morris Animal Foundation
Ommiting nonsensitive words in path
Another aproach I thought about was to ommit some words (stopwords).
Explained by example:
Title: Location and gMap modules are working now
URL: /Location_gMap_modules_working.4711.node
The much more defined the spider relevant information is - the much better ;)
Beta snippet
can be found here http://drupal.org/node/72601