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

  1. Set up a multilingual Drupal site with at least two languages (e.g., English and Spanish).
  2. 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 at https://example.com/es/page).
  3. Create a node in English (e.g., "About Us" at /about-us).
  4. 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.
  5. Run the Entity Mesh data generation process (drush entity-mesh:generate node or via the batch form).
  6. 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.

Command icon 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

lpeidro created an issue. See original summary.

antonio nunez made their first commit to this issue’s fork.

antonio nunez’s picture

Assigned: Unassigned » antonio nunez

antonio nunez’s picture

Assigned: antonio nunez » Unassigned
Status: Active » Needs review

This 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.

lpeidro’s picture

Status: Needs review » Fixed

It works as expected.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.