6

I'm considering alternatives to pathauto module for automatic URL alias generation.

The reasons I want to stop using it are the following:

  • Most of the aliases are [node-type]/[node-title] so I do not need all other functionality.
  • Token goes wild and takes too much resources on pages where it needs to display the available tokens. I have 16 content types and quite a lot of fields and certain pages take considerably more time to load due to the large list of tokens.
  • I do not need token module for anything else
  • I would have 2 big modules less - pathauto and tokens, which would have impact on performance

I checked some similar discussions on drupal.org, but none of them offered really an alternative.

I'm now looking into optimizing the fields as each content type has its own set of fields (meaning they are not shared); this was done because of the performance but ironically I ended up with performance issues on the other end.

Setup: D7 with all latest modules.

Did you have similar problems? How did you solve them? Any words of wisdom?

Thanks!


[UPDATE]

For anyone looking for something similar, here is an article which explains how to handle that through a custom module.

1 Answer 1

1

The main performance problem with tokens is the token UI/token browser. You can disable that by overriding theme_token_tree() and returning an empty string. What I once did on a site is replace it it with a link that was able load the browser using ajax, but even that didn't help anymore on a site with ~300 fields and lots of references.

Pathautho/Token don't depend on entity.module?

5
  • Thank you for the help. Exactly that is the problem on my site so I'll try to go around it with theme_token_tree(). Regarding entity module - my bad, they don't depend on it :) How did you handle the issue on the site with ~300 fields and many references? Jul 22, 2012 at 12:26
  • I didn't. The ajax replacement works in the way that it allows to render the site normally, but trying to load the token UI then simply results in an out of memory error, that we currently have to live with. The only real solution for that problem would be a lazy loading browser, that only loads the next level of the tree when you click on it. But that is a complicated problem to solve (in a way that is also accessible and so on).
    – Berdir
    Jul 22, 2012 at 15:16
  • Thank you again, it worked :) I did apply the fix and pages now load with the same speed as the rest of the site. Any input on the pathauto alternative? Even though it's a great module, I would use something smaller as [node-type]/[node-title] is enough for the site. Jul 22, 2012 at 19:55
  • 1
    I would recommend against replacing Pathauto. It's the standard solution for that task and it's really irrelevant for it's complexity if you just use two tokens or dozens. Most tokens and the token system itself are defined in Drupal core. It's a large module due to features like bulk creation, duplicate handling and configurablity/extendability. The thing with small (custom) modules which only solve a specific use case is that you will sooner or later find a limitation in it or start adding special cases.
    – Berdir
    Jul 24, 2012 at 18:55
  • I'll mark this as the answer - you showed how to resolve the performance issue and after lot of thinking and testing it might be better to still use pathauto and token. Thanks again! Aug 10, 2012 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.