Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Does the limit of 255 still apply in drupal 8?
The maximum alias length and maximum component length values default to 100 and have a limit of 255 from Pathauto. You should enter a value that is the length of the "alias" column of the url_alias database table minus the length of any strings that might get added to the end of the URL. The recommended and default value is 100.
Comment | File | Size | Author |
---|---|---|---|
#12 | pathauto-increase_alias_length_1024_char-2858096-12.patch | 1.95 KB | johnlutz |
#3 | pathauto-increase_alias_length_1024_char-2858096-3.patch | 3.06 KB | rp7 |
Comments
Comment #2
rp7 CreditAttribution: rp7 for Government of Flanders commentedDrupal core supports aliases with a maximum length of 1024 characters (see the "alias" column in the "url_alias" table). Pathauto currently limits this to 255 characters. Patch attached increased this Pathauto enforced limit to 1024 characters to make it consistent with Drupal core.
Comment #3
rp7 CreditAttribution: rp7 for Government of Flanders commentedSecond attempt, now with the test adjusted.
Comment #4
rp7 CreditAttribution: rp7 for Government of Flanders commentedComment #5
maxilein CreditAttribution: maxilein commentedIsn't there a function to get the drupal default alias length by some function - instead of hard-coding it?
(I searched without success - I don't have an orientation in the code for path aliases..)
Comment #6
rp7 CreditAttribution: rp7 for Government of Flanders commentedPutting this issue back to "Active".
Found out that on my installation, I have the following (well hidden) piece of custom code running:
This makes my earlier statement about Drupal core supporting aliases up to 1024 characters... completely false. :-/
@maxilein
The only option I currently see is reading the schema definition. Something in the lines of
But I'm in doubt if this is a proper way of doing things.
Comment #7
Chris CharltonFWIW, URL lengths can be up to 1024 bytes, not characters. The coincidence of that number made me think I should post this.
Comment #8
maxilein CreditAttribution: maxilein commented255 * 4 bytes = 1020 bytes
BUT it seems that nowadays almost all browsers support much longer urls.
See a good discussion here: https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of...
Comment #9
maxilein CreditAttribution: maxilein commentedIt makes me like the idea of a Drupal function even more...
Comment #10
Chris CharltonSafe is best. Anything above legacy lengths/limits should be an override/setting for those who want to adopt. I'm just thinking of the legacy sites and browsers some regions may still be stuck on.
Comment #11
maxilein CreditAttribution: maxilein commented255 is too limiting for a modern cms.
We should at least enable a proper possibility, make it configurable and let each Admin decide on his/her own.
Comment #12
johnlutzRerolled patch against latest release 8.x-1.5.
Comment #13
BerdirPathauto doesn't control the storage, we can't just create aliases that are longer than what's allowed in the url_alias/path_alias table.
So I have no plans to change that.
Comment #14
daften CreditAttribution: daften at Dropsolid commentedFor anybody needing a solution, we've developed a small module that takes care of it: https://www.drupal.org/project/path_alias_length
Any feedback welcome there of course.