Problem/Motivation
I am in the middle of researching how to achieve #1245712: How to have URL paths of all translated nodes be synchronized based on the source node and I faced this need to be able to define in-mass a certain pattern for all content types for a single language. So, instead for example of filling all these:
Default path pattern: [node:content-type:machine-name]/[node:source:title]
Pattern for all English Article paths: [node:content-type:machine-name]/[node:title]
Pattern for all English Basic page paths: [node:content-type:machine-name]/[node:title]
Pattern for all English Block node paths: [node:content-type:machine-name]/[node:title]
Pattern for all English Blog entry paths: [node:content-type:machine-name]/[node:title]
Pattern for all English Event paths: [node:content-type:machine-name]/[node:title]
Pattern for all English Forum topic paths: [node:content-type:machine-name]/[node:title]
...
+ more patterns here if one has more content types in their site
...
It would be great if I could do something like this:
Default path pattern: [node:content-type:machine-name]/[node:source:title]
Default path pattern for English language: [node:content-type:machine-name]/[node:title]
Proposed resolution
In other words, I am suggesting to add per-language global path patterns that would apply for all content in each of these language-specific patterns. What we set there would be overridden by any specified pattern for specific content types. So we would have:
Default path pattern (applies to all content types with blank patterns below)
Default path pattern for English language (applies to all English content types with blank patterns below)
Default path pattern for Italian language (applies to all Italian content types with blank patterns below)
Default path pattern for Spanish language (applies to all Spanish content types with blank patterns below)
...
Remaining tasks
...
User interface changes
In the patterns tab there will be additional global patterns for each language installed.
API changes
???
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | pathauto-language.png | 27.1 KB | quicksketch |
Comments
Comment #1
dave reidWhy not make your own token that uses node:source:title if available, otherwise falls back to node:title? Then you just set your default pattern to use that token.
Comment #2
klonos...because I didn't know one could make their own custom tokens! With fallback feature too!! I am heading to the token documentation...
Comment #3
klonosA quick scan through the documentation showed this recipe. Were you talking about something like that Dave? This instructs people to create their own module that provides custom tokens. I'll see what I can do -it will be my first module!!- and if I succeed I'll upload my custom module.
The reason I filed this request though was to provide an easy solution to even drupal newcomers. So, please do consider this. As I said, it is part of what would help get this #1245712: How to have URL paths of all translated nodes be synchronized based on the source node fixed.
Comment #4
quicksketchIt looks like Pathauto must have added this functionality sometime since 2011. If I understand correctly, the UI now includes a "Default" option you could use for all languages, then a specific one for English. The selection now does:
1) Node type language-specific if found.
2) Node type generic if found.
3) Generic for all nodes if found.
4) No alias.
Comment #5
miccelito commentedPathauto i18n
https://www.drupal.org/project/pathauto_i18n