From an older issue:
#284484: disable pathauto for one or more types of nodes
Hi,
I can't seem to find how to disable pathauto for different node types, specifically project and project release...
I'm pretty sure this is possible but can't seem to find how to do it.
I suggest we introduce a <none>
pattern for explicit disabling.
Related
Doc: "When the pattern for a node type is left blank, the default pattern will be used. But if the default pattern is also blank, Pathauto will be disabled for that node type."
-> not a solution. We want to distinguish between "intentionally disabled for this type" and "noone cared enough to define a pattern for this, so we use the default."
"adding the pattern UI to the content type forms."
-> this would be nice, but would not be a sufficient solution to this particular problem. Let's discuss this elsewhere.
#273104: Using "progressive disclosure" for alias patterns
-> would be nice, but would not be a sufficient solution.
Comment | File | Size | Author |
---|---|---|---|
#21 | pathauto-none_pattern-1218952-21.patch | 1.69 KB | rooby |
Comments
Comment #1
donquixote CreditAttribution: donquixote commentedComment #2
donquixote CreditAttribution: donquixote commentedComment #3
donquixote CreditAttribution: donquixote commentedWow, that's supereasy to implement.
If you want I can produce a patch. Please tell me if I need to start with D7 or D6.
For now, here is what I changed in D6.
In function _pathauto_validate_pattern_element():
becomes
In function pathauto_create_alias():
becomes
Comment #4
donquixote CreditAttribution: donquixote commentedI wonder if we need to trim($value) on form submission.
Comment #5
donquixote CreditAttribution: donquixote commentedBtw1, if you rather prefer a checkbox than a
<none>
pattern..We could still store the
<none>
, but display a checkbox.Btw2, the
<none>
would currently not validate, so we do not need to worry about people who actually want<none>
as the alias :)Comment #6
donquixote CreditAttribution: donquixote commentedThe D6 patch (D7 will follow)
Comment #7
donquixote CreditAttribution: donquixote commentedNice. Now D7.
"untested", because I did not actually try the D6 -dev release or anything of D7.
Comment #8
jumpbug CreditAttribution: jumpbug commentedI was looking for this and #3 was a solution, thanks!
Comment #9
Jim Kirkpatrick CreditAttribution: Jim Kirkpatrick commentedI love the idea of but for me that should override the existing alias, including deleting it IF the pathauto settings are set to 'create new alias, delete old one'...
If I check nodes in the content management page and run the 'update url alias' action, I should expect any with pattern of '' to be unaliased and cleansed the alias table of unwanted entries if my PA settings say so.
Do these patches behave this way? They should IMHO...
Comment #10
JordanMagnuson CreditAttribution: JordanMagnuson commentedIs there a reason this has not been implemented in the last year and a half?
Comment #11
jantoine CreditAttribution: jantoine commentedPatch in #7 is fantastic! It even removes the "generate" checkbox when '' is set for the pattern. Code comments might need work to meet Drupal coding standards, but this is a great starting point. I am guessing this hasn't been implemented because after five years of working with Drupal, I am just now needing it ;)
Comment #12
wvd_vegt CreditAttribution: wvd_vegt commentedHi
Just checked and an alias of
node/[node:nid]
does not generate an alias. It also does not need a patch.
It generates a message though
•Ignoring alias node/536 because it is the same as the internal path.
Comment #13
donquixote CreditAttribution: donquixote commented#7: pathauto.none-disable.D7.untested.patch queued for re-testing.
Comment #14
jason.fisher CreditAttribution: jason.fisher commentedApplied successfully here to the latest 7.x-dev.
Comment #14.0
jason.fisher CreditAttribution: jason.fisher commentedexplain why the default blank-blank is not a solution.
Comment #15
SiliconMind CreditAttribution: SiliconMind commentedblank-blank solution is poor because it requires you to provide ALL patterns explicitly (except default). If you add new content type, then you also have to provide a new pattern explicitly.
Comment #16
andyhu CreditAttribution: andyhu commentedI really hope this could be implemented. It's very useful!
Comment #17
jimmyko CreditAttribution: jimmyko as a volunteer commentedWhy no one follow?
Comment #18
jmuzz CreditAttribution: jmuzz commented+1 #7 works for me.
Comment #19
xstean CreditAttribution: xstean commentedLooks like no one noticed what wvd_vegt said
He's right, if you write the original path has pattern, Drupal wont generate a new one.
So, for nodes you should set node/[node:nid]
For users: users/[user:uid]
You don't need a patch, just try it :)
Thanks a lot wvd_vegt
Comment #20
rooby CreditAttribution: rooby commentedWhile #12 may be a viable work around, I think the explicit option as per the patch is the preferable solution.
Comment #21
rooby CreditAttribution: rooby commentedFunctionally it works for me.
Here is a reroll with node & comment numbers in the file name that applies to latest dev. No code was changed except a minor change to the docblock of the validation callback.
The only thing that I think would be a good addition would be some help text somewhere that tells users that
<none>
is a possibility.