• Like Us On


how to install disqus on yii2

how to install disqus on yii2

Disqus is very famous commenting system these days.Million websites using it.It is very easy to install on wordpress and other other cms available.While i was trying to integrate disqus on my own Yii2 site, there was no article which show a beginner step by stem guide to effectively install disqus on yii2.So i decided to write one.Here i show you how to install disqus on yii2 step by step guide.

1. Go to Disqus site and login there or sigup if you don't have account.

2. Now after login click on gear icon on top right and click Add disqus to site.

3. There you will be redirect to another page.Now click on Get Started.

4. Now new window will appear you to asking 1.I want to comment on sites 2.I want to install Discus on my site.Choose second option as shown below.

5.Now fill your site name and select appropriate category and click create site. Remember just enter site name not domain name or url of site.

6.Your site will be created and you have done half work.Now leave this window open.Now i will guide you though second part that is installing 2Amigos widget for Discus.Now open your composer.json file and add below code to it and update the composer.

"2amigos/yii2-disqus-widget" : "~1.0"

7. After composer finish update use this class on view file where you want to show the comment system.

use dosamigos\disqus\Comments;

8. Now all is set up and you are ready to show comments.Just paste below code on exact location where you want to show comments.

echo Comments::widget([
    'shortname' => 'yoursitename',
    'identifier' => $blog->id

sortname is your website name which you saved in step 5.Identifier can be any unique thing but it is better to use id as slug may be changed overtime when we update article.By following this guide you can install discus on anything not only blog or product.If you like post share it with friends.Happy coding.

Related:- How to install Google reCaptcha on Yii2

Share Post

comments powered by Disqus