Preview Plugin
-
If I wanted a function that strips certain words from the
.content p
(post) fields (removes them at DB level), what would be the best way to achieve this? I am pulling an RSS feed that contains text I'd like to remove (this is a private site I am running designed to work as a security feed), and I'd rather have the URL pretty formatted, but of course, it will not render because of the other text on the same line.Any ideas?
Thanks
-
@phenomlab hmm...
On the way in, you'd be hooking into
filter:post.create
, possibly. At that pointcontent
from an RSS feed would be html.I'll tell you how I'd approach it, which may be the wrong approach
npm i cheerio
- Parse incoming html and find all the anchors
- Do your preview generation
- Replace content using cheerio selectors.
Funny enough, this is exactly how
link-preview
works -
@julian said in Preview Plugin:
Funny enough, this is exactly how link-preview works
Yes,
OGProxy
works the same way My thoughts would be around a regex - something likenodebb-plugin-beep
but with the ability to completely remove words rather than just say "[censored]" - I could fork that plugin and write in that functionality actually...Hmmm....
-
@phenomlab I'm sure you've seen this?
https://stackoverflow.com/a/1732454
Won't stop people like us from trying though hahaha
-
@julian Yes, thanks. Actually, I think I narrowed down the issue. There is a fork of
nodebb-plugin-rss
that I am using callednodebb-plugin-rss-brad
- I think the changes here are that it renders other HTML (description - like v1.3 of the official NodeBB version did), so I went for that.I think it is that plugin that adds "Via: " as it is doing it on all links, and not on my other site which uses the stock NodeBB version.
Let me confirm, and if so, this can be closed.
-