Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If the node body contains the node title, a link/tooltip is put on the string causing a self reference.
As an example:
node title: "Level 1"
same node body: "To master level 1 you need bla bla bla"
In body field "level 1" will be linked to itself.
Comments
Comment #2
keesje CreditAttribution: keesje as a volunteer commentedI agree. Anyone a good suggestion on approach? Look at the URL to see if whe are in node-page scope? what about node teasers then? or node fields listed in views?
Comment #3
keesje CreditAttribution: keesje as a volunteer commentedThis is in now, please test. Matching words are skipped, of the current URL matches the URL that belongs to that maching word. Should work for both terms and nodes.
Comment #4
LaravZ CreditAttribution: LaravZ commentedCan you point me to the code or commit that fixes this issue?
Comment #5
keesje CreditAttribution: keesje as a volunteer commentedsure
/src/GlossifyBase.php
...
...
Comment #6
LaravZ CreditAttribution: LaravZ commentedThe code fixes the issue for the node view page, however, the self reference remains on the preview, edit and draft node pages. That is, "node/xxx" is not considered a match for "node/preview/...", "node/xxx/edit" and "node/xxx/latest". Would it be an idea to compare the node id's themselves? We could explode the current_path for nodes and taxonomies and compare it to the id retrieved from the term.
Comment #7
keesje CreditAttribution: keesje as a volunteer commentedI thought about that too. Its a slippery slope, data retrieved from node's or term's can show up in numerous ways and URL variations. On top of that it's possible that the data retrieved and parsed is not the "abbreviate" data itself but other field(s). I can imagine excluding those URL variations core provides though.
Comment #8
LaravZ CreditAttribution: LaravZ commentedTrue. I had no problems with self reference when I used a query string, so for now it might be sufficient to identify the core URL variations and perhaps the ones provided by the content moderation module(experimental core).
Comment #9
keesje CreditAttribution: keesje as a volunteer commentedSuggested approach: self-reference checking must have its own method, so implementations of the base class in glossify_node and glossify_taxonomy can implement their own.
Patches welcome.
Comment #10
keesje CreditAttribution: keesje as a volunteer commentedBoldy marking this "fixed", since its good enough for visitors in most scenarios. Please open a new issue for further improvements, preferably with patch.