Custom Onebox engine


#1

I am interested in developing a Onebox engine to neatly display/embed content from one of my own websites in a custom format - similar to the GitHub custom engines.

Assuming that I fork the Onebox repo on GitHub, and push all my custom code and changes, how would I then go about telling my Discourse instance to use my modified version of Onebox, rather than the official version?

The engine I am looking at developing is fairly custom, so I doubt that I will file a PR to include it back into the main codebase.


(Vinoth Kannan) #2

You don’t have to create custom onebox engine. You can achieve it by creating a plugin for Discourse.

For examples, You can check some other onebox plugins below

Search · discourse onebox · GitHub

Search results for 'onebox category:22' - Discourse Meta


#3

Thanks @vinothkannans . I was reading the Onebox GitHub README without even thinking it could be a plugin for Discourse. Much easier :slight_smile:


(Felix Freiberger) #4

You might want to take a look at this plugin:

I did that to enable oneboxing of one of my own sites. It simply replaces the onebox with an iframe with a specific URL, where my website delivers a special embed-friendly view of the target site.

I pretty clueless when it comes to Ruby, so this may not be state of the art, but it might be enough to get you started :slight_smile:

(Remember to also test what happens in notification mails containing the post.)


#5

Thanks @fefrei . Yes, I am also pretty clueless about Ruby…but slowly picking up how things work from reading a heap of sample code :slight_smile:


(Felix Freiberger) #6

In that case, my approach has the advantage of needing only a tiny bit of ruby code, while most of the logic is happening on your website (which is responsible for producing the embed-view) :slight_smile:


#7

Awesome, thanks @fefrei :slight_smile: