You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that the "description" field defaults to nothing when there are no defined values in <head>. This means that websites like Wikipedia have empty descriptions, whereas user expectation would likely be that the description is a snippet of the first paragraph of the article (for example).
It would be very useful to be able to add a custom description handler to the options that could handle this case. e.g.
I could certainly do something like write my own fetch & processing behavior, only passing to link-preview-js when I need a generic fallback, but I'd rather have an integrated solution.
Another alternative could be some post-process callback that gives you the result and the cheerio doc so that you can make changes. e.g. used like:
getLinkPreview('http://foo.bar',{postProcessText: (result,doc)=>{if(!result.description){result.description=doc('article p').text()// Or some site-specific customization}}}).then(...)
Would you be interested in a push request along these lines?
The text was updated successfully, but these errors were encountered:
I've noticed that the "description" field defaults to nothing when there are no defined values in
<head>
. This means that websites like Wikipedia have empty descriptions, whereas user expectation would likely be that the description is a snippet of the first paragraph of the article (for example).It would be very useful to be able to add a custom description handler to the options that could handle this case. e.g.
I could certainly do something like write my own fetch & processing behavior, only passing to link-preview-js when I need a generic fallback, but I'd rather have an integrated solution.
Another alternative could be some post-process callback that gives you the result and the
cheerio
doc so that you can make changes. e.g. used like:Would you be interested in a push request along these lines?
The text was updated successfully, but these errors were encountered: