Pathauto appends "-0" to newly-created paths, if one should already exist. This, in order to avoid clashes.

I understand the abstract for the logic of such a safeguard, but I'm wondering what effects there might be if I were to omit this mechanism from code, and instead substitute it for a function that just denies the duplication and spits out a warning?

Currently it silently performs the duplication and - apart from cluttering-up the URL_Alias table - I believe it's causing more problems than it solves... well, that's what I think, hence the question: Is there some other fundamental problem lying in-wait that I should be aware of?

Proposal/Food for Thought

For added flexibility and latitude, would it not be possible to allow duplicate terms, if it is a child of another term?

Or, for "flatter" sites; allow duplicates only if it belongs to another vocab, and then only if vocab is used as a placeholder?

Scenario:

Say I have a 'Product' vocab, and a 'Tutorial' one too.

Each one sufficiently distinct as to warrant a term called "Software" - Semantically meaning: Software products and Software tutorials.

Their respective paths might be:

example.com/software
example.com/tutorials/software

... or various other concotions.

Point being; 'Software' is being interpretated as the same, meaning the last one created gets the dreaded "-0" appended.

This is a real problem not only for multi-hierarchical structures but also for some modules (Taxonomy_menu is one off the top of me head) which get confused about which path to use.

Comments

greggles’s picture

Version: 4.7.x-1.x-dev » 6.x-1.x-dev

Well, I think we have to consider a couple things:

1. I believe it's currently possible to get the effect you desire using: [vocab]/[catpath] as the pattern. That seems like the best solution.
2. Aside from the whys and the problems, the question becomes "what should pathauto do when it's internal pattern process creates a pattern that already exists"?

Your solution (I believe) is that Pathauto should send back an error to the user and say "that path is already taken, please consider another one". I think this would be quite confusing to a non-administrator user. They don't know what it is that they did that caused a duplicate path because to them they were just adding a term to a freetagging category, or creating a new node or some other similar action. For example, if you can create terms but not administer pathauto this would be very confusing.

Does that help? I recognize this is a support request, but I changed it to HEAD since I don't plan on making many behavioral changes to 4.7 (which this might become, though I'm not convinced at this point).

TheWhippinpost’s picture

Thanks Greggles

I've never tried the vocab/catpath pattern - I might give it a go on the next new section I create.

Your solution (I believe) is that Pathauto should send back an error to the user and say "that path is already taken, please consider another one". I think this would be quite confusing to a non-administrator user. They don't know what it is that they did that caused a duplicate path because to them they were just adding a term to a freetagging category, or creating a new node or some other similar action. For example, if you can create terms but not administer pathauto this would be very confusing.

Your understanding is right.

OK, I see the concerns (I've been thinking about them for some time now) and I'll try and speak as both a user and an adminstrator:

As admin, the problems (clearly) rest. But it goes beyond that: Modules get "confused" leading to dupe-path issues as well as unexpected behaviour (Taxonomy_Menu for one, as mentioned)... and then there's the database which becomes cluttered/bloated.

Ultimately, this must translate to the user if expected behaviour is "lost", and, over time, the system becomes weighed down.

As admin, well, I think there are probably 2 camps in the wild ATM:

- Those that are unaware that certain aspects of their site are either behaving unexpectedly, and/or, have dupe paths (I've seen enough of them to know they exist).
- Have nailed the problems down but are paranoid whenever any new content is added, whether by admin or user, and will, at some point, be faced with pruning down the "excess fat".

I'd see the "error" messages as being more of a clarification in most cases (it's all in the wording) as most dupes are probably caused by dupe terms, rather than file-paths:

- If there is a duplication of term about to take place; ask the user if they want to use the existing term (ie... within the existing vocab/hierarchy), or create a new one within another vocab (or hierarchy).

- If there is a duplication of filename about to take place, then simply offer it back for editing to make it unique.

I see this as giving the user control more than anything else. What's more, I don't think this is behaviour that anyone who's saved a file has not experienced before: "This file already exists. Do you wish to overwrite this file?... Click no to rename... blah blah".

My question about removing the dupe function was more of a personal one than anything because I'm seriously considering removing it as my "enjoyment" of both using, and adminstering Drupal is taking a knock.

I proffer the wider picture because it just seems the right thing to aim for in terms of having a predictable operation that interacting modules can depend, a leaner database and, single paths... these are negatives which outweigh the one in favour of minimising user interaction, IMHO, and, dare I say, in-keeping with Drupal philosophy.

greggles’s picture

Just to reiterate the taxonomy/node creation problem as I think about it more, basically the problem is that Drupal works fine with a duplicate node tite, or terms in different vocabularies that may cause a collision but which are unique in themselves. So, if a user sees a message saying "Your title should be unique" or "Your taxonomy term should be renamed to be unique" that may be totally in appropriate. Especially given that an admin could configure aliases to only be 10 characters long, then when a user creates content which is unique at the 11th character they will be super confused. I'm having a hard time seeing how we could implement a duplicate path check in pathauto when really it comes down to admin configuration.

So there are a couple problems that you identified:

-site gets slow from excessive paths

But if we do a rename of the paths we will have the same number of paths as before, so the speed will be the same. Also, I don't make changes to help performance unless there is a thorough benchmark. I'm assuming you have no benchmark and my hunch is that this isn't a significant bottleneck.

-other modules get confused

Well, there's not much that Pathauto can do about that. To fix that you should file bugs in the other modules.

-File names should be submitted to the respective projects (upload.module or attachments, or...) and there's not much to be done about them here.

As for turning off the duplicate checking - what would it do instead? I'm not really sure where it may lie, so I can't point you in the right direction.

Sorry I can't be more helpful on this.

TheWhippinpost’s picture

basically the problem is that Drupal works fine with a duplicate node tite, or terms in different vocabularies that may cause a collision but which are unique in themselves.

Because Drupal assigns an unique interger id to each new piece of content (term or node)?... Regardless of of what's in that content (ie... whether it's dupe or not)?

So, if a user sees a message saying "Your title should be unique" or "Your taxonomy term should be renamed to be unique" that may be totally in appropriate.

I'm not sure if I'm understanding you in the right context here: Are you saying that it'd be inappropriate because Drupal, per se, "works fine with a duplicate node tite, or terms in different vocabularies that may cause a collision but which are unique in themselves."?

Especially given that an admin could configure aliases to only be 10 characters long, then when a user creates content which is unique at the 11th character they will be super confused.

I see your point on that score but I think that would be more of an admin set-up issue; afterall, we have that same "limit" option (or problem, whichever way you want to look at it) now

But if we do a rename of the paths we will have the same number of paths as before,

Well, not if I have path:

example.com/category/index.htm

and

example.com/category/index.htm-0

Just to be clear: I'm not talking (primarily) about unique content which "happens" to share the same file-paths as another file (though that's part of this discussion obviously); I'm talking about system/module operations which result in different file-paths to the same content as a result of this feature, which then become referenced by modules (or whatever).

The incidence of a user dupe-naming a title, is likely to be low. Dupe-naming a term is going to be higher, hence my suggestion that the same term-name, be "allowed" to be seen to be unique, if it belonged to another vocab - or directory - which then leaves open the option to present a choice to the user, ie... rename, overwrite (if permission), or assign to existing parent of the same name.

Currently (unless I'm missing sommat the [vocab]/[catpath] pattern resolves), I can only have the term, "software" once. Creating another "software" term, in another vocab or category, results in:

example.com/software/index.htm-0

Also, I don't make changes to help performance unless there is a thorough benchmark. I'm assuming you have no benchmark and my hunch is that this isn't a significant bottleneck.

I don't, you're right. However, if abstract argument can't win it alone, do we really want redundant paths bloating-up the database (apart from anything else)?

... already we have redundant: taxonomy/pathauto/term (From memory, could be wrong, but you know the one I mean!) entries, in addition to the one's being discussed.

Well, there's not much that Pathauto can do about that. To fix that you should file bugs in the other modules.

Well, here's the muddy bit then. As I see it, there's more pain and "damage" inflicted by this than not - It seems untidy, has a questionable existence (at least in certain contexts (no database wants duplication does it)), takes away user (and admin) control, causes problems with the SE's, problems with module operation and ultimately, problems with the user and admin experience (takes ages plucking out the detritus from the database don't ya know!).

If we can agree that we don't want the same content - in every respect - to be served by different paths (for the same purpose), and that it is not good practice to have those paths twice in the DB, when, again, they are for the same purpose, then surely we have to ask for the user's intention, at minimum?

dave reid’s picture

Status: Active » Closed (won't fix)

At this point, this issue is going to be marked as won't fix due to a lack of follow-up. If you can provide the requested details or more information, please re-open the issue.

This message is automatically generated. If you feel it could be improved, feel free to comment on http://drupal.org/node/467548

Note: No, we do not want redundant paths at all. Pathauto should be and is encouraging unique aliases per path.