Virtual path

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
narres's picture

Comments

Are you familiar with pathauto?

robertDouglass's picture

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

narres's picture

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?

robertDouglass's picture

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

narres's picture

I did it in 4.6.x: performance is really much better now in 4.7.x

So you rewrite incoming and outgoing URLs?

robertDouglass's picture

How does your templating system work? How do you map incoming aliased URLs to node/x?

In my template I'm only

narres's picture

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.

robertDouglass's picture

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

narres's picture

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.

robertDouglass's picture

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

narres's picture

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

greggles's picture

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

Ommiting nonsensitive words in path

narres's picture

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

narres's picture

can be found here http://drupal.org/node/72601