I've started using Pathauto to create user friendly paths on one of my sites and have hit a bit of a snag. Specifically, not all of the paths branching out from the user page can be aliased automatically. (This was previously mentioned in #410242: Adding an additional pathauto user path alias) My user page has tabs added by other modules, tabs added through Views, and tabs added by Core that aren't handled by Pathauto. This is mostly an issue of aesthetics, but it also gives the appearance of jumping between two different directories which could confuse some users.
I suppose I could add the necessary hooks to expose these paths to Pathauto, but that seems like a lot more work than it should be. I also don't want to write more hooks every time I add something to the user page. Now in the case of the user page, all of the paths sit in the menu router as user/%/something-tacked-on. I would think that it would be easier to find each occurrence of this and build each alias from that list.
I realize this won't work for every path (such as user/%/some/%/thing) but it should work for a good number of cases. The rest could be caught and set aside for special treatment.
Implementing something like this for the user page alone would remove 2 fieldsets from the automated alias settings page while expanding it's functionality at the same time.
Comments
Comment #1
gregglesThe idea seems somewhat reasonable to me, but would still need to be optional so the admin UI would be simpler, maybe, but the parts can't be totally removed.
Your solution also assumes that for "user/%/something-tacked-on" people want the pattern to be "user/[user-raw]/something-tacked-on" but they might want "user/[user-raw]/a-different-thing-tacked-on"
What do you think? Do I understand your idea properly?
Comment #2
Cybergarou commentedSounds like you understand what I was getting at. You're right about my assumption too. I suppose a list of paths from the menu router would have to be presented to allow users to change the static portions of each path. Maybe something similar to the node path settings.
I also noticed that nodes suffer the same problem. My idea won't work very well for nodes though due to the fact that having different paths based on the content type is commonly desired. Maybe the menu router could be used to expand what Pathauto already does, but that would still assume something about what the alias should be.
There is another problem that rises from using the menu router in this way. We can't really determine what each % represents. It would be up to the user to figure that out. (Not really a problem most of the time, but I'm sure it would find a way to become a problem.)
It's starting to sound like all of this would begin to make the UI more complicated instead of simpler. The question is, would gaining the ability to use Pathauto with paths that aren't exposed by a hook be worth this added complication?
Comment #3
gregglesIn my opinion, no. I'll leave this open to get feedback from others.
I imagine that some day Drupal's core menu/path system will handle the "user/1 is aliased to users/admin therefore use users/admin/edit for user/1/edit" but until core does, I don't want to bloat Pathauto's interface to try to solve this.
Comment #4
Cybergarou commentedSince the Sub-path URL Aliasing module provides the functionality of this feature request we can mark this as fixed.