# Adapt github changes to my own site

**URL:** https://meta.discourse.org/t/adapt-github-changes-to-my-own-site/83832
**Category:** Support
**Created:** [26 במרץ,‏ 2018,‏ 6:35am UTC](https://meta.discourse.org/t/adapt-github-changes-to-my-own-site/83832 "2018-03-26T06:35:40Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![frold](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/frold/32/82547_2.png) [@frold](https://meta.discourse.org/u/frold)
#### Post date: [26 במרץ,‏ 2018,‏ 6:35am UTC](https://meta.discourse.org/t/adapt-github-changes-to-my-own-site/83832/1 "2018-03-26T06:35:40Z")

</div>

I try in a new topic instead.

I did add a few line of change to some githib files based on this topic:

> [@Change max chars in Onebox - enlarge your Onebox?](https://meta.discourse.org/t/change-max-chars-in-onebox-enlarge-your-onebox/81205/15):
>
> Ahh, dooh. It seems like the source that the script rip data from by standart only contains 250 chars If you eg. go to https://www.amazon.com/gp/aw/d/0323353177/ And view it as user agent: Mozilla/5.0 (iPhone; CPU iPhone OS 5\_0\_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3 The div with productDescription only contains 250 chars. If you press the field you go to a new page with the path https://www.amazon.com/gp/aw/d/0323353177/#produc…

The line is added to the github pull request but I guess they will not be adapted to the release  
[https://github.com/discourse/onebox/pull/383](https://github.com/discourse/onebox/pull/383)

My question is without knowledge of github how do I get these changes to work on my own setup?

I did try to add

> [https://github.com/frold/onebox.git](https://github.com/frold/onebox.git)

to my app.yml - but it doesnt seems like the changes are adapted to my site…

What else can I try?

I just want to add 2 lines of changes to my site, but it seems like a marathon 😃

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [27 במרץ,‏ 2018,‏ 5:32am UTC](https://meta.discourse.org/t/adapt-github-changes-to-my-own-site/83832/2 "2018-03-27T05:32:54Z")

</div>

If I understand what you’re trying to do correctly, you will need to create a plugin to make that modification (or fork the entire discourse repo and use that in your app.yml, but that is **absolutely not** recommended).

---

<div class="post-metadata">

### Author: ![frold](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/frold/32/82547_2.png) [@frold](https://meta.discourse.org/u/frold)
#### Post date: [27 במרץ,‏ 2018,‏ 6:10am UTC](https://meta.discourse.org/t/adapt-github-changes-to-my-own-site/83832/3 "2018-03-27T06:10:12Z")

</div>

A plugin to get use of 2 lines of changes… that seems a little overkill… 🤪 (and far over my level) 😉

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [27 במרץ,‏ 2018,‏ 8:13am UTC](https://meta.discourse.org/t/adapt-github-changes-to-my-own-site/83832/4 "2018-03-27T08:13:28Z")

</div>

I know, “plugin” sounds like overkill because it’s a big word. But all a plugin really does it modifies/amends discourse’s code, which is exactly what you’re trying to do, right? Of course you can do so much more with plugins than change 2 lines of code, but changing those two lines is entirely possible and not overkill at all. It’s pretty much the same as what you’ve tried, only the “proper” way. It’s so easy that even I was able to do it:

> [@Hack to enable invitations for Trust level 1 users](https://meta.discourse.org/t/hack-to-enable-invitations-for-trust-level-1-users/44103/18):
>
> Thanks to @vinothkannans’s primer above, I managed to put together the [discourse-TL1-invites plugin](https://github.com/tophee/discourse-TL1-invites). tada My first one, yeay! sunglasses And the best thing is: it works (from what I can tell so far). The only thing I am a bit unsure about is that I am not 100% sure whether I am allowing TL1 users anything apart from forum invites and topic invites here: The only change I made is obviously the trustlevel in line 37, but I don’t quite grasp, what all the possible objects are that TL1 use…

Check out that topic and see if you can make it work for your case.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [27 במרץ,‏ 2018,‏ 5:22pm UTC](https://meta.discourse.org/t/adapt-github-changes-to-my-own-site/83832/5 "2018-03-27T17:22:21Z")

</div>

Like @tophee said, plugins do not need to be complicated. Here’s another really simple plugin you can look at (this one increases the maxiumum value allowed in a site setting): [GitHub - jomaxro/discourse-plugin-site-setting-override · GitHub](https://github.com/jomaxro/discourse-plugin-site-setting-override).

* * *

Let me speak from personal experience about why modifying source code is a bad idea. Before working for Discourse I worked for a company that used Discourse internally. They had linked it to a WordPress install, and instead of using the API to connect WP to Discourse they decided to add a custom route to Discourse. They did this by copying the `routes.rb` file, adding the new route, and then overwriting the `routes.rb` file any time Discourse updated. As new routes were added by Discourse they were “removed” by the modified `routes.rb` file that was overwriting it. Eventually the homepage route was modified and we overwrote it on update, causing Discourse to frequently throw errors.

The file was modified in mid-2016. We started seeing errors in mid-2017. It took nearly a week to track down the cause of the errors, because we assumed something had changed _recently_, not something that hadn’t been touched in a year.

**tl;dr:** Don’t modify files directly. Even if they don’t hurt you today they can come back and bite when you least expect it.

---

<div class="post-metadata">

### Author: ![frold](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/frold/32/82547_2.png) [@frold](https://meta.discourse.org/u/frold)
#### Post date: [28 במרץ,‏ 2018,‏ 7:23am UTC](https://meta.discourse.org/t/adapt-github-changes-to-my-own-site/83832/6 "2018-03-28T07:23:59Z")

</div>

I might seems easy to make a plugin, if you are a coder.

As a non coder - I have no idea about where to start to solve my issue…

What files are needed? what snippets to paste in the files? where to and how to put a plugin at git hub? etc…

Im totally blank…

Things are easy if you know them… the down side of Discourse is the rather steep learning curve… It is very much for coders to coders.

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [28 במרץ,‏ 2018,‏ 7:40am UTC](https://meta.discourse.org/t/adapt-github-changes-to-my-own-site/83832/7 "2018-03-28T07:40:30Z")

</div>

> [@frold](#):
>
> I might seems easy to make a plugin, if you are a coder.

I am not a coder either. Did you read the topics linked in the previous posts?

> [@frold](#):
>
> the down side of Discourse is the rather steep learning curve…

There is always room for improvement, but I don’t think that’s a fair assessment. You are trying to customize discourse beyond what is foreseen in the UI (which is very easy to use). If you want to “hack” a software, you can’t really blame it for that being difficult.

Besides, the community here is usually quite helpful…

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [28 במרץ,‏ 2018,‏ 2:52pm UTC](https://meta.discourse.org/t/adapt-github-changes-to-my-own-site/83832/8 "2018-03-28T14:52:27Z")

</div>

> [@frold](#):
>
> As a non coder - I have no idea about where to start to solve my issue…

Check out @angus’s awesome guide at [Learn how to start building stuff for Discourse if you're newbie (like myself)](https://meta.discourse.org/t/how-to-start-building-stuff-for-discourse-if-youre-newbie-like-myself/45954). For plugins @eviltrout wrote up a series of #howto topics that start with [Developing Discourse Plugins - Part 1 - Create a basic plugin](https://meta.discourse.org/t/beginners-guide-to-creating-discourse-plugins-part-1/30515)

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [26 ביולי,‏ 2020,‏ 6:28am UTC](https://meta.discourse.org/t/adapt-github-changes-to-my-own-site/83832/9 "2020-07-26T06:28:39Z")

</div>



---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [26 ביולי,‏ 2020,‏ 11:42pm UTC](https://meta.discourse.org/t/adapt-github-changes-to-my-own-site/83832/10 "2020-07-26T23:42:42Z")

</div>


