| Project: | Pathauto |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (won't fix) |
Issue Summary
It would make sense if Pathauto can automatically detect & remove duplication in URL paths. The objective is to make URLs look nicer (and more SEO friendly too).
Here is an example URL I have in my site, which Pathauto generated based on my Automated Alias Settings. It looks unsatisfactory:
mysite.com/apple-trees/growing-apple-trees-guide
In the above example, my taxonomy term is "apple trees" and my node title is "Growing Apple Trees Guide". The problem is, the URL says "apple trees" twice. The duplication is unnecessary.
So I thought it would be cool if Pathauto create an automatic alias without duplication. Ex- mysite.com/apple-trees/growing-guide
I realize you can do it manually by simply editing the URL alias manually, but the idea here is to automate intelligent behavior.
Comments
#1
I do like the idea.
Side note, feature requests are for 7.x-1.x only at this point.
#2
This feels much more automatic than what pathauto should be doing, to me.
I think it should be done in a separate module if at all. We should just make sure it's possible for other modules to provide features like this.
#3
This would be a nice "checkbox" option that Pathauto could provide on the URL aliases settings page. I don't agree that it should be in another module, since this is exactly the type of thing that "Pathauto" specializes in.
This checkbox option could be added under:
Home › Administer › Site building › URL aliases and finally, under General settings
Call it "Remove duplicate phrases" Y / N
#4
Here's a patch against HEAD that removes duplicate URL segments.
#5
Thanks! This is perfect.
#6
Again, I feel like this will be really confusing to end users who have hierarchical structures in their vocabulary or books and find that whole segments are missing which may ruin a well planned pattern that matches up with views.
We haven't had a lot of requests for this over the years, it seems like a bad idea to introduce without lots of feedback.
#7
Although it seems fairly trivial to add I agree that this functionality seems a little more niche. Just because you can clutter the settings page with options doesn't mean you should. If more people comment on the issue then maybe its worth considering but otherwise I agree with greggles, KISS.
#8
#9
For now, won't fixing this.
#10
See #1409260: Document hook_pathauto_alias_alter in API.txt for how to implement this feature in your own module using hook_pathauto_alias_alter().