A user, hoangviet, wants to display random descriptions in Onebox instead of the default description defined by the website owner. Falco explains that Onebox uses a special description tag defined by the website owner, and JimPas adds that searching for random text within an article is not feasible.
hoangviet asks if there’s a way to edit the code to achieve this, and JimPas reiterates that the description is defined by the website owner and cannot be changed. However, Falco suggests that a custom plugin can be created to overwrite the Onebox behavior.
As hoangviet is a developer, Falco points to an example plugin and offers to guide him in creating a custom plugin. hoangviet is hopeful that this will be a solution to display random descriptions in Onebox. hoangviet requests more detailed instructions from Falco and is willing to do his own research if needed.
The default Onebox takes description as the first paragraph in the original article, I want to describe it as random (get a random paragraph in the original article)
For example:
I do not want to describe in the default onebox as:
The description cannot be displayed randomly as you are looking to have done. That would require searching the article for random text - something that is not feasible. If you search for Onebox requirements, you will see the three required things necessary for a website to give in order for the article to be Oneboxed. A text search within an article is not one of them and it not possible.
Edit: Falco posted a few seconds ahead of me.
See Falco’s 2nd sentence above. It’s defined by the website owner to decide what will be seen when their link is embedded. There is nothing Discourse can do about that. Sorry.
But there isn’t any code to edit. The website owner creates a tag with the description that is used for the embedded link. That is what Discourse uses to Onebox the link. There are no other descriptions (random or otherwise) that exist for Onebox to retrieve and use. Please see Creating rich link previews with Onebox
Thank you
Falco is proposing a solution using the Custom Plugin, perhaps this will be a solution for me to develop. I still hope my goal is to display random descriptions in onebox, which are workable.
If Falco could give more detailed instructions, during the nCov epidemic season, it would be the most meaningful gift I received.
If Falco is busy, I can also do my own research. In the process of implementing this problem, if there is a problem, I hope to be able to inbox you.
Thanks Falco.