将 GitHub 更改适配到我的网站

I try in a new topic instead.

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

The line is added to the github pull request but I guess they will not be adapted to the release

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

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 :smiley:

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

2 个赞

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

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:

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

3 个赞

正如 @tophee 所说,插件不必复杂。这里还有一个非常简单的插件供你参考(这个插件用于提高站点设置中允许的最大值):https://github.com/jomaxro/discourse-plugin-site-setting-override。


让我结合个人经验谈谈为什么修改源代码是个糟糕的主意。在为 Discourse 工作之前,我曾在一家公司任职,该公司内部使用 Discourse。他们将其与 WordPress 安装进行了关联,但没有使用 API 来连接 WordPress 和 Discourse,而是决定为 Discourse 添加自定义路由。他们的做法是复制 routes.rb 文件,添加新路由,然后在每次 Discourse 更新时覆盖 routes.rb 文件。随着 Discourse 不断添加新路由,这些路由会被覆盖的 routes.rb 文件“移除”。最终,主页路由被修改,我们在更新时覆盖了它,导致 Discourse 频繁报错。

该文件在 2016 年年中被修改。我们从 2017 年年中开始看到错误。花了将近一周时间才找到错误原因,因为我们以为问题出在“最近”的变更上,而不是一个已经一年未被触碰的旧文件。

tl;dr: 不要直接修改文件。即使它们今天没有造成问题,也可能在你最意想不到的时候带来麻烦。

10 个赞

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.

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

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…

5 个赞

Check out @angus’s awesome guide at Learn how to start building stuff for Discourse if you're newbie (like myself). For plugins @eviltrout wrote up a series of howto topics that start with Developing Discourse Plugins - Part 1 - Create a basic plugin

4 个赞