Problem/Motivation
We often have editors ask why their autogenerated URLs are being truncated. We discovered that the default maximum alias length is set to `100` characters, which means we have to remember to increase it on each site we build.
I traced the history and found the first instance of the default value in this commit: https://git.drupalcode.org/project/pathauto/-/commit/dfec31c7f5519fb7eca...
That led me to #57046: Feed aliases fail when max length of URL is the same as the size of the dest column which discusses paths breaking because they were longer than the maximum of 128 characters set in the path table. That limit was increased to 255 characters in #288946: Increasing path length to 255 chars.
#2858096: Increase maximum alias length to 1024 characters was closed as won't fix due to the size of the suggested change (1024 characters).
Proposed resolution
With that in mind, let's increase the default value to 224 which is 7/8ths of the column's maximum. That should still give plenty of room *31 characters) for trailing segments like `/edit` and `/delete` even in alternate languages.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | admin-config-search-path-settings-after.png | 75.49 KB | emilymathew |
| #11 | admin-config-search-path-settings-before.png | 75.32 KB | emilymathew |
| #6 | 3387049-6-increase-maximum-default.patch | 1.41 KB | deviantintegral |
| #4 | 3387049-increase-maximum-default.patch | 1.08 KB | deviantintegral |
Issue fork pathauto-3387049
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
deviantintegral commentedComment #4
deviantintegral commentedGitlab seems to be having trouble this morning. Here's a patch just in case my push doesn't eventually make it to the merge request.
Comment #6
deviantintegral commentedFixes unrelated but now required code style issues.
Comment #7
berdirThe second patch seems to not include the actual change?
Nice work on checking related issues and history on this. Fine with changing the default, but IMHO the update function is not necessary. If someone cares, they'll also see this in the release notes, and that increases the risk of people using patches with update functions for minimal gain.
I'm in the process of switching to gitlabCI, so merge requests are preferred over patches, would be great to have that updated.
Comment #8
deviantintegral commentedYeah, agreed on MRs, I think with the recent hosting changes my prior issues should be solved. I'll file one without the update hook.
Comment #10
deviantintegral commentedMR opened.
Comment #11
emilymathew commentedI have applied the merge request !58 in #9 in pathauto version 8.x-1.12 in my Drupal 10.2.2 installation. The changes worked for me. The default Maximum alias length now updated to 224 from 100.
Attaching the screenshots before and after.
Comment #12
emilymathew commentedComment #13
emilymathew commentedComment #14
naveenvalechaWe're using this PR on a customer website from a long time and it's working fine for us without any problem.
RTBC + 1
Comment #15
steinmb commentedBumping issue, I was unable to spot why this is just sitting RTBC but not getting merged.
Comment #18
berdirIMHO, aliases should be relatively short and it's just a default setting that people can change. Not going to die on that hill though.
That said, I just realized again today that the indexes on the path_alias table are limited to 191 characters, we should not by default go above that as it could be a a performance issue if you have many aliases that are that long.
Comment #19
mably commentedLet's lower it to 150 to be sure.
Comment #21
mably commentedComment #23
steinmb commentedThank you from blowing through multiple issues in pathauto the last days, this included.
Out of curiosity and that we a have a site with really long aliases, what performance problems could we experience/look out for?