0

I would like to be able to create my own tokens for pathauto. In D7 I was able to create with the variable module some variables to represent a portion of an url. These variables where available as tokens and I had a different per content types and where translatable.

For example I would like to be able to do that:

[content-type-monthly-theme-base-url]/[node:title]

I can do that:

featured/[node:title] but the word 'featured' is not translatable

Another solution would be able to translate patterns. ATM only the pattern title is translatable! Not usefull...

As a last resort I can add a field base_url in my content type Monthly theme and use it as a token. But this means each time someone would create a node of this content type he or she would have to make sure the base_url field is in the right translation. This should really be configurable else where.

1 Answer 1

0

There are issues open about making patterns translatable.

And patterns actually can be per-language, so you can have multiple patterns, one for each language.

You could also implement the token yourself but be aware that for example during bulk generation, pathauto might create aliases for different languages in the same request, so you can't rely on the current language.

2
  • How do I make the patterns translatable. This would work. At the moment only the title of the pattern is translatable. Pretty useless... Commented Oct 17, 2016 at 12:48
  • Ok got it. You can add a condition per language. This is kind of unnatural, they could have used the standard translate function, like any other entity in Drupal 8. This is where I looked. I tried to hack the pathauto_pattern.schema.yml and add translatable: true to the pattern definition, re-installed the module and clear cache, but that did nothing... :( Commented Oct 17, 2016 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.