Problem/Motivation
Entity Mesh parses the rendered HTML of content entities to detect internal links and map content relationships. During this process, it resolves each link's target to identify the corresponding entity and language.
On multilingual sites where the default language (e.g., English) is configured without a language path prefix in the URL (a common Drupal configuration), Entity Mesh incorrectly resolves absolute links that point to the default language.
Specifically, when a content entity in a non-default language (e.g., Spanish at /es/node/123) contains an absolute link manually entered in CKEditor that points to a page in the default language (e.g., https://example.com/about-us -- no /en/ prefix), Entity Mesh resolves the link as if it were pointing to a page in the same language as the source entity (Spanish), rather than correctly identifying it as a link to the English version of the target content.
This produces incorrect relationship data in the mesh graph and link analysis tables. Additionally, the ability to accurately detect cross-language links is a valuable feature for content auditing.
Steps to reproduce
- Set up a multilingual Drupal site with at least two languages (e.g., English and Spanish).
- Configure language detection to use URL path prefix, and set the default language (English) to have no path prefix (e.g., English pages at
https://example.com/page, Spanish pages athttps://example.com/es/page). - Create a node in English (e.g., "About Us" at
/about-us). - Create a node in Spanish and manually insert an absolute link in a CKEditor field pointing to the English node:
https://example.com/about-us. - Run the Entity Mesh data generation process (
drush entity-mesh:generate nodeor via the batch form). - Inspect the resolved link data for the Spanish node.
Expected result: The link should be resolved as pointing to the English translation of "About Us". The target language should be identified as English.
Actual result: The link is resolved as pointing to the Spanish translation (or a generic non-language-specific version), because the URL has no language prefix. Entity Mesh assumes the absence of a prefix means the link targets the same language as the source entity.
Issue fork entity_mesh-3584705
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
antonio nunez commentedComment #5
antonio nunez commentedThis MR corrects the resolution logic to check the URL prefix settings: if a link has no language prefix, it is now correctly assigned to the language configured with an empty prefix, which always corresponds to the site’s default language.
Comment #6
lpeidro commentedIt works as expected.