vmg / rinku

Autolinking. Ruby. Yes, that's pretty much it.
ISC License
597 stars 67 forks source link

A way to whitelist/blacklist/test URL patterns to link? #76

Closed dendrochronology closed 6 years ago

dendrochronology commented 6 years ago

I'm working on a project that auto links URLs in user comments. It works great, but occasionally we get a decent amount of link spam. They're valid posts from valid users, they're just not in line with the community guidelines.

Since these forums are highly topical, I'd love a way to pass a whitelist of acceptable domains, or a regex pattern, so URLs to domains related to the relevant products get linked, but not random stuff. That way we don't aggravate users by blocking their posts, but also de-incentivize the SEO spam.

Is there a way to do that with rinku? I'd rather not fall back on regex'ing the text myself.

kivikakk commented 6 years ago

Rinku has no such functionality, no; its scope is kept deliberately narrow. I would be most inclined to parse the resulting HTML and filter elements in the DOM, perhaps as part of a larger HTML pipeline.

dendrochronology commented 6 years ago

That's a great suggestion, @kivikakk. Thanks!