# Custom Onebox engine

**URL:** https://meta.discourse.org/t/custom-onebox-engine/54588
**Category:** Development
**Created:** [December 21, 2016, 6:04am UTC](https://meta.discourse.org/t/custom-onebox-engine/54588 "2016-12-21T06:04:20Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![skoota](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/skoota/32/65472_2.png) [@skoota](https://meta.discourse.org/u/skoota)
#### Post date: [December 21, 2016, 6:04am UTC](https://meta.discourse.org/t/custom-onebox-engine/54588/1 "2016-12-21T06:04:20Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [December 21, 2016, 7:06am UTC](https://meta.discourse.org/t/custom-onebox-engine/54588/2 "2016-12-21T07:06:30Z")

</div>

You don’t have to create custom onebox engine. You can achieve it by [creating a plugin](https://meta.discourse.org/t/beginners-guide-to-creating-discourse-plugins/30515) for Discourse.

For examples, You can check some other onebox plugins below

[Repository search results · GitHub](https://github.com/search?p=1&q=discourse+onebox&type=Repositories&utf8=%E2%9C%93)

[Search results for 'onebox category:22' - Discourse Meta](https://meta.discourse.org/search?q=onebox%20category%3A22)

---

<div class="post-metadata">

### Author: ![skoota](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/skoota/32/65472_2.png) [@skoota](https://meta.discourse.org/u/skoota)
#### Post date: [December 21, 2016, 7:17am UTC](https://meta.discourse.org/t/custom-onebox-engine/54588/3 "2016-12-21T07:17:33Z")

</div>

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

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [December 21, 2016, 10:07am UTC](https://meta.discourse.org/t/custom-onebox-engine/54588/4 "2016-12-21T10:07:54Z")

</div>

You might want to take a look at this plugin:

> <https://github.com/fefrei/discourse-pseuco-onebox/blob/master/plugin.rb>

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 🙂

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

---

<div class="post-metadata">

### Author: ![skoota](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/skoota/32/65472_2.png) [@skoota](https://meta.discourse.org/u/skoota)
#### Post date: [December 21, 2016, 10:29am UTC](https://meta.discourse.org/t/custom-onebox-engine/54588/5 "2016-12-21T10:29:22Z")

</div>

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

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [December 21, 2016, 10:41am UTC](https://meta.discourse.org/t/custom-onebox-engine/54588/6 "2016-12-21T10:41:35Z")

</div>

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) 🙂

---

<div class="post-metadata">

### Author: ![skoota](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/skoota/32/65472_2.png) [@skoota](https://meta.discourse.org/u/skoota)
#### Post date: [December 21, 2016, 11:17pm UTC](https://meta.discourse.org/t/custom-onebox-engine/54588/7 "2016-12-21T23:17:45Z")

</div>

Awesome, thanks @fefrei 🙂
