Avoid linking a specific istance of a word in content

Created on 19 June 2024, 11 months ago

Problem/Motivation

In the site I'm working on, there are citations to some articles or other resources, and the titles of these articles often have one or more words contained in the glossary.
Is there a way to mark these words to bypass glossify linking?

As you can see in the image, the word "prosodia" is linked and it should not be...
Thanks!!

💬 Support request
Status

Active

Version

3.0

Component

Miscellaneous

Created by

🇨🇱Chile andrés chandía

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @andrés chandía
  • 🇩🇪Germany Anybody Porta Westfalica

    @Andrés Chandía so you're suggesting something like a "ignore list"?

    Feel free to create a MR with that feature or pay a developer to do so. Thanks for the suggestion!

  • 🇩🇪Germany Anybody Porta Westfalica
  • 🇨🇱Chile andrés chandía

    No, because ignore list would ignore the word all over, I was thinking in something like a tag to ad to words that should be ignored...
    word
    Anyway, what I did to solve it, was to create a new text format that does not include glossify and apply it to the node where I don't want words linking to taxonomy by means of glossify..
    Thanks..

  • 🇵🇹Portugal joao.ramos.costa

    Hi folks,

    here are my 5 cents,
    I think there's at least two ways to deal with the issue both compromising solutions, and I'd say can be cumulative:

    1 - Add a ckeditor5 plugin that add a tag wrapping the word we want to skip in text editors, as @Andrés Chandía suggests and simply

    2 - Use a custom field per entity which would exclude the word directly from the query, this could be achieved by simply add a new hook in the fashion of (eg) hook_taxonomy_vocabs but letting developers alter the query, adding for instance a query join with a condition ie

    $query->join('taxonomy_term__field_exclude_glossary', 't__feg', 't__feg.entity_id=tfd.tid');
    $query->condition('taxonomy_term__field_exclude_glossary.value', 0);
    

    I can work on both and open a MR,

    just LMK your thoughts

  • 🇩🇪Germany Anybody Porta Westfalica

    @joao.ramos.costa thanks - I never had the need for both, but I think, the exclude wrapping / class functionality is always helpful and most flexible.

    So I'd tend to 1.!

  • 🇵🇹Portugal joao.ramos.costa

    Hi @anybody,

    thanks for quick responding. I do agree that 1 is more flexible, indeed, but think of a big project where content editors want to remove all glossary links for specific word, but want to keep the taxonomy term intact, that's happening in my case :D, using the custom tag would evolve a big update with a lot of "take cares" to test.

    So I'd say both can be useful,
    the 1st for cirurgical alterations, and the 2nd for a more flexible approach, could be to exclude terms by condition, could be to add others, there's no limit for the imagination.

    I can provide a MR with both if you agree.

    cheers

  • 🇩🇪Germany Anybody Porta Westfalica

    Yeah let's put 2. into a submodule then. I think it's an edge-case. Better split that off.

  • 🇵🇹Portugal joao.ramos.costa

    Hi @anybody,

    I wasn't aware of https://www.drupal.org/project/glossify/issues/3504552 Make "glossify-exclude" class detection more robust Active at the moment I start working on ckeditor 5 plugin, but the solution provided by @prudloff seems even more flexible than ckeditor5 plugin, as any site editor may only need to leverage CkEditor styles dropdown plugin and add the class to the given words/elements, as they please.

    So, IMO this fix partially this issue, then I'll drop glossify_exclude module I was working on, which it could lead to other issues, in fact. Drupal version support, GlossifyBase class overwrite, etc.

    But, problem/solution 2 persists - exclude list. In that case no extra module is needed, or even desired, as the hook should be triggered on nodeTooltip and taxonomyTooltip.

    tkx

  • 🇩🇪Germany Anybody Porta Westfalica

    @joao.ramos.costa yes that's totally fresh!

    Feel free to add further improvements as discussed!

  • Merge request !3634555743: Include tag on Filter query. → (Merged) created by Unnamed author
  • Pipeline finished with Success
    3 months ago
    Total: 147s
    #415905
  • Pipeline finished with Skipped
    3 months ago
    #415930
  • 🇩🇪Germany Anybody Porta Westfalica

    Merged, totally makes sense! Would you like to solve other things in this issue? Then let's set this back to NW.

  • 🇵🇹Portugal joao.ramos.costa

    Thanks for merging,

    but what other issues you mean ? If means @andrés chandía concern to exclude some words to be "glossified", can simply wrap the term in text editor within a span with glossify-exclude class.
    eg
    <span class="glossify-exclude">prosodia</span>

    Can be easily configured with ckeditor styles plugin:
    eg

    as per https://www.drupal.org/project/glossify/issues/3504552 Make "glossify-exclude" class detection more robust Active suggestion.

    So I don't see anything more to do here.

  • 🇵🇹Portugal joao.ramos.costa

    So, concluding (sorry for the spam), regarding:

    1 - Cirurgical terms excluding:
    add .glossary-exclude class to a span wrapping the concerning term. (Or Include https://www.drupal.org/project/glossify/issues/3504552 Make "glossify-exclude" class detection more robust Active to a more robust approach)

    2 - Exclude concerning term all the time, implement hook_query_tag_alter that is available from 6622277d, and add the needed condition (in the above example add a boolean field called field_exclude_from_glossary, or a $query->condition('tfd.name', "Not me", '!='); and the implementation example).

  • 🇩🇪Germany Anybody Porta Westfalica

    All good! Thought you'd maybe still want to add a submodule or whatever. Then I think it would finally make sense to add a MR for the README.md documentation here?

    Much appreciated, thanks!

  • 🇵🇹Portugal joao.ramos.costa

    Absolutelly ,

    on it.

    I'm already getting confused with the issues :)).

    Thanks for the quick response!

  • Pipeline finished with Success
    3 months ago
    Total: 278s
    #416269
  • 🇵🇹Portugal joao.ramos.costa

    Hi @anybody,

    (other) kind reminder that documentation was added in MR39, WDYT ?

    thank you :))

  • 🇩🇪Germany Anybody Porta Westfalica

    @grevil: Could you have a short look and give your feedback? Thanks!

  • First commit to issue fork.
  • 🇩🇪Germany Grevil

    Did some adjustments to the wording. Otherwise, LGTM!

  • 🇩🇪Germany Grevil

    All green. Merging.

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

Production build 0.71.5 2024