Problem/Motivation
I can export nodes with translations normally to my recipe and I can see how the path alias for the translation is exported in the YML with this structure:
translations:
es:
path:
-
alias: /home
langcode: es
but when I import the content no alias in Spanish is created.
Steps to reproduce
Create a node with a translation and a path alias for both languages.
Export the node.
Verify the path alias is in the translation
Import the node into another site.
Verify the path alias is only created for the original language
Proposed resolution
Handle the special case of path alias for translations
Remaining tasks
Code
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Comments
Comment #2
shank115 commentedI tried to reproduce this using the exact steps described on a clean Drupal instance, with no contributed modules other than those needed for content translation. In that environment, both the default-language and translation aliases were imported correctly, so I couldn't reproduce the described behavior.
If Pathauto is enabled, that could explain the issue:
Pathauto overrides the path field's item/list classes, and its
PathautoItem::postSave()only allows core's alias-persistence logic to run when its internal Pathauto state is explicitly set to 'skip'. The way the DefaultContent importer populates the field can leave that state at 'create' instead, which silently prevents the imported alias from being saved.Comment #3
rodrigoaguileraIndeed it is pathauto. Thank you so much. My bad for not testing in a minimal enviroment
The path from this issue resolve the problem:
https://www.drupal.org/project/pathauto/issues/3535498