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

PhilY created an issue. See original summary.

keesje’s picture

I 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?

keesje’s picture

Assigned: Unassigned » keesje
Status: Active » Needs review

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

LaravZ’s picture

Can you point me to the code or commit that fixes this issue?

keesje’s picture

sure
/src/GlossifyBase.php
...

          if ($current_path == str_replace('[id]', $terms[$terms_key]->id, $urlpattern)) {
            // Reinsert the found match if whe are on the page
            // this match points to.
            $dom_fragment->appendXML($term_txt);
          }

...

LaravZ’s picture

Status: Needs review » Needs work

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

keesje’s picture

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

LaravZ’s picture

True. 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).

keesje’s picture

Priority: Normal » Minor

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

keesje’s picture

Status: Needs work » Fixed

Boldy marking this "fixed", since its good enough for visitors in most scenarios. Please open a new issue for further improvements, preferably with patch.

Status: Fixed » Closed (fixed)

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