Jako / Crosslinks

Manage crosslinks in MODX Revolution
https://jako.github.io/Crosslinks/
GNU General Public License v2.0
8 stars 4 forks source link

Enhancement: Prefer long-tail matches #11

Open azeller opened 3 years ago

azeller commented 3 years ago

From an SEO standpoint, preferring a longer string that matches the same text over a shorter string would make more sense.

Let's say we have brand pages, one of them being "BMW" and let's say we have model pages like an "BMW M4 Competition"

"BMW M4 Competition" should definitely match the page for the BMW M4 Competition car and not the page for the BMW brand. Right now, there is no rank for a certain keyphrase defined so Crosslinks will grab whatever it can and match accordingly. It would be great to prefer longer phrases over short ones.

This might be as simple as sorting the possible matches descending by string-length first and then start link replacement.

I'd be glad to hear some feedback, because I will probably not be the first person to ask for this. In the meantime we can have a look at the code and provide a PR for this.

Jako commented 3 years ago

Maybe this could be handled by replacement rules with an extra sortindex or by reverse ordering the replacements. That way the long words are handled first.