Generate path by node type without Pathauto

mr.alinaki's picture

Hi!

Is it possible to generate url aliases to nodes by their type without pathauto? I.e. topic/234, forum/456, where topic and forum are some content types? Maybe url_alter may help with that?

Comments

You could use nodeapi

markus_petrux's picture

Implement $op 'insert' to create the alias, $op 'delete' to delete the alias, ...

http://api.drupal.org/api/function/hook_nodeapi/6

I use url_alter to implement

mr.alinaki's picture

I use url_alter to implement outbound an inbound on my site. But I don't understand, how I can get node type in that functions.

Read url_alter.api.php for details

markus_petrux's picture

...and then, you probably need to read the node to know the type it is.

Note that this function is used a lot, so you may want to optimize all you do here.

has to be asked...

greggles's picture

Why not Pathauto?

What are you trying to do? custom_url_rewrite_* and url_alter and hook_menu_alter all may be important/useful toward the goal depending on what you are doing.

Im also wondering this

macrocosm's picture

Were importing and regularly updating 40,000+ nodes and have had to use drush amongst other things to make it perform well. One thing that was disappointing was the massive performance hit from using pathauto, it increased the time it took to import & update by at least 1000%, which is a no go for us.

Did you find some other solution, we have a few ideas but I am curious if you found a good option?

Cheers!

performance problems with pathauto

greggles's picture

The performance problem is almost certainly related to tokens. If you figure out which tokens are causing the problems, I'd recommend removing their generation (even if by hacking...).

In Drupal 7 that's no longer a problem due to the on-demand generation of tokens.

Thanks for the tip .. ill see

macrocosm's picture

Thanks for the tip .. ill see if we can figure which tokens are dragging the most.

Thats nice to know about Drupal 7 ... suppose I should give that a whirl sooner than later. Im using pressflow drupal though so I'll be waiting for the 7.x release of that before we switch.

Cheers!

Paths

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: