Add a setting to bypass the uniquifier if a path alias already exists

Created on 13 April 2022, over 2 years ago
Updated 1 August 2024, 4 months ago

Problem/Motivation

In our project, we wanted to stop having path aliases suffixed by "-INCREMENT" for existing ones, instead show to the contributor that the path alias already exists.
With this update, the content save action is still done, but no path alias is generated and an error message is displayed.

Steps to reproduce

  1. Tick the new settings Bypass alias uniquifier
  2. Create a new node with an existing path alias and save

Proposed resolution

Create a new setting which allows to bypass the path alias uniquifier for existing aliases.

Remaining tasks

Add tests.

User interface changes

API changes

Data model changes

Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

🇫🇷France Heisen-blue France

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇦Canada vamirbekyan Toronto

    unfortunately unique_alias_checker module does not work with node:origin:title token.

  • 🇮🇳India shabana.navas
    +++ b/src/PathautoGenerator.php
    @@ -247,6 +247,12 @@ class PathautoGenerator implements PathautoGeneratorInterface {
    +      throw new \InvalidArgumentException('Path alias should be unique.');
    

    I think we can change this error message to be a bit more informative. Something like:

    throw new \InvalidArgumentException(sprintf('The automatically generated alias %s conflicted with an existing alias.', $alias));
    

    would help admins figure out which are the problematic aliases.

  • 🇮🇳India shabana.navas

    Earlier patch didn't apply. Adding again with informative error message.

  • Status changed to Needs work 4 months ago
  • 🇨🇭Switzerland berdir Switzerland

    I'm not convinced that this feature is important enough to be added to the main module. the uniquifier is a service, the module that was created could implement this approach by wrapping the service and implementing this logic there.

    To be added, tests would be required and a merge requests, patches are no longer tested.

Production build 0.71.5 2024