如何以与 Wordpress 类似的方式将 Disqus 评论系统添加到 Rails 应用程序中?

发布于 2024-08-25 06:48:41 字数 456 浏览 14 评论 0原文

在 WordPress 中,Disqus 插件允许您选择通过 RSS 或通过电子邮件订阅帖子。有没有类似于 Rails 的 WordPress 插件的插件。 Norman 的 Disqus 插件 只是使用 Disqus 站点来使其工作。我希望能在本地存储更多的东西。有关我的意思的示例,请查看此 博客条目

我已经知道,由于 Rails(特别是这个应用程序)正在使用 Authlogic(加上 Facebook Connect),因此 Disqus 不能与身份验证系统耦合得太紧密。有没有人做过这个或想出一种方法来做到这一点?

In Wordpress, the Disqus plugin allows you to choose to subscribe to a post via RSS or via email. Is there a pluign similar to the Wordpress plugin for Rails. Norman's Disqus plugin just uses the Disqus site to make it work. I was hoping to have things more stored locally. For an example of what I mean, take a look at this blog entry.

I already know that since Rails (this application in particular) is using Authlogic (plus Facebook Connect), that Disqus cannot be too tightly coupled with the Authentication system. Has anyone ever done this or figured out a way to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浅笑轻吟梦一曲 2024-09-01 06:48:41

请原谅我,但我对你的问题有点困惑……

你说 WordPress 使用的 disqus 插件允许你通过 RSS 和电子邮件订阅……诺曼的 Disqus 插件也是如此。我正在使用它,并且可以向您保证它提供与 WordPress 使用的版本相同的功能。

其次,你说“Norman 的 Disqus 插件只是使用 Disqus 网站来使其工作”......我不是在开玩笑,但是你这是什么意思?我希望 Norman 的 Disqus 插件使用 Disqus 网站,而不是 BurgerKing 的网站.... :)

您似乎觉得 Norman 的 Disqus 插件不起作用?它工作得很好,就像女作家一样......

你还说“我希望将更多的东西存储在本地。”您是否暗示您想将您的评论存储在您自己的数据库中?当然不是吗?如果是这样的话,使用 disqus 就没有意义了......

这里有一些关于让normans disqus插件工作的提示......

1) gem install disqus 

如果你希望当用户点击 http://mysite.com/blog/1-test-post 然后打开 show.html.haml (或 erb(如果您不使用 haml)并在您希望注释出现的任何位置添加以下内容:\

#disqus_thread
  = disqus_thread

如果您使用 erb,则执行此操作:

<div id ="disqus_thread">
  <%= disqus_thread %>
</div>

完成。

我可以向您保证,Norman 的插件(或 gem)的工作方式与在 Rails 中和在 Wordpress 上的工作方式相同...

祝您好运 - 如果您遇到任何问题,请告诉我,我很乐意提供帮助。

编辑:

忘记提及您需要将一些内容粘贴到“Rails::Initializer.run do |config|”内的 config/environment.rb 文件中堵塞:

  config.after_initialize do
    Disqus::defaults[:account] = "your account name"
    # so that the comments will load up in development environment
    Disqus::defaults[:developer] = true 
    Disqus::defaults[:container_id] = "disqus_thread"
    Disqus::defaults[:show_powered_by] = false
  end

Pardon me, but I'm slightly confused by your question...

You state that the disqus plugin used by Wordpress allows you to subscribe via RSS and email.... Well so does Norman's Disqus plugin. I am using it and can assure you that it offers the same functionality of the version Wordpress uses.

Secondly, you say that "Norman's Disqus plugin just uses the Disqus site to make it work"... I'm not being funny here, but what do you mean by that? I'd expect Norman's Disqus plugin to use the Disqus site, as opposed to say, BurgerKing's site.... :)

It seems that you are under the impression that Norman's Disqus plugin doesn't work? It works fine, just like the wordress one...

You also say that "I was hoping to have things more stored locally." Are you implying that you want to store your comments in your own Database? Surely not? There would be no point in using disqus if that were the case.....

Here are some tips on getting normans disqus plugin working....

1) gem install disqus 

If you want the comments to appear when a user hits http://mysite.com/blog/1-test-post then just open up show.html.haml (or erb if you are not using haml) and add the following wherever you want the comments to appear:\

#disqus_thread
  = disqus_thread

If you are using erb then do this instead:

<div id ="disqus_thread">
  <%= disqus_thread %>
</div>

Done.

I can assure you that Norman's plugin (or gem) works just the same as it does in Rails as it does on Wordpress....

Good luck - let me know if you have any trouble, I'll be happy to help..

EDIT:

forgot to mention that you need to stick some things in your config/environment.rb file inside the "Rails::Initializer.run do |config|" block:

  config.after_initialize do
    Disqus::defaults[:account] = "your account name"
    # so that the comments will load up in development environment
    Disqus::defaults[:developer] = true 
    Disqus::defaults[:container_id] = "disqus_thread"
    Disqus::defaults[:show_powered_by] = false
  end
岁月静好 2024-09-01 06:48:41

http://praaveenvr .blogspot.in/2014/05/adding-disqus-comment-system-to-rails-3.html?view=sidebar

第 1 步

gem install disqus

第 2 步

添加到 application.rb(用户应该注册才能使用服务)

config.after_initialize do  
   Disqus::defaults[:account] = "youraccountname"  
   Disqus::defaults[:developer] = true  
   Disqus::defaults[:container_id] = "disqus_thread"  
   Disqus::defaults[:show_powered_by] = false  
   end  

step3

添加此到查看文件(例如:show.html.erb)

<div id ="disqus_thread">  
 <% = raw disqus_thread %>  
</div>  

启动服务器并检查......

http://praaveenvr.blogspot.in/2014/05/adding-disqus-comment-system-to-rails-3.html?view=sidebar

step 1

gem install disqus

step2

add in application.rb(user should registered to consume service)

config.after_initialize do  
   Disqus::defaults[:account] = "youraccountname"  
   Disqus::defaults[:developer] = true  
   Disqus::defaults[:container_id] = "disqus_thread"  
   Disqus::defaults[:show_powered_by] = false  
   end  

step3

add this to view file(example: show.html.erb)

<div id ="disqus_thread">  
 <% = raw disqus_thread %>  
</div>  

start the server and check.....

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文