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.

Issue fork pathauto-3387049

Command icon 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

deviantintegral created an issue. See original summary.

deviantintegral’s picture

Issue summary: View changes
deviantintegral’s picture

Status: Active » Needs review
StatusFileSize
new1.08 KB

Gitlab 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.

Status: Needs review » Needs work

The last submitted patch, 4: 3387049-increase-maximum-default.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

deviantintegral’s picture

Status: Needs work » Needs review
StatusFileSize
new1.41 KB

Fixes unrelated but now required code style issues.

berdir’s picture

Status: Needs review » Needs work

The 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.

deviantintegral’s picture

Yeah, agreed on MRs, I think with the recent hosting changes my prior issues should be solved. I'll file one without the update hook.

deviantintegral’s picture

Status: Needs work » Needs review

MR opened.

emilymathew’s picture

Issue tags: +#ContributionWeekend, +#ContributionWeekend2024
StatusFileSize
new75.32 KB
new75.49 KB

I 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.

emilymathew’s picture

Status: Needs review » Reviewed & tested by the community
emilymathew’s picture

Issue tags: -#ContributionWeekend, -#ContributionWeekend2024 +ContributionWeekend, +ContributionWeekend2024
naveenvalecha’s picture

Assigned: deviantintegral » Unassigned

We're using this PR on a customer website from a long time and it's working fine for us without any problem.
RTBC + 1

steinmb’s picture

Bumping issue, I was unable to spot why this is just sitting RTBC but not getting merged.

mably changed the visibility of the branch pathauto-3387049-3387049-increase-the-default to hidden.

mably changed the visibility of the branch 3387049-increase-the-default to hidden.

berdir’s picture

Status: Reviewed & tested by the community » Needs work

IMHO, 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.

mably’s picture

Let's lower it to 150 to be sure.

mably’s picture

Category: Feature request » Task
Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

steinmb’s picture

Thank you from blowing through multiple issues in pathauto the last days, this included.

...as it could be a a performance issue if you have many aliases that are that long.

Out of curiosity and that we a have a site with really long aliases, what performance problems could we experience/look out for?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.