Step 1: Register For Disqus Account
You will have to register for a Disqus account first and then visit your dashboard page.

Step 2: Create a new Site
Once you have created an account then you can Create a New Site from the admin section. The steps for this is very straight forward so do make sure to fill in all the necessary credentials for your website.

Step 3: Get the Universal Code
Next, you will have to get the universal code from the Select Platform page.

The code will be as follows, do note that you need to copy your own code (the URL is different) for each comment section..
<div id="disqus_thread"></div> <script> /** * RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS. * LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables */ /* var disqus_config = function () { this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable }; */ (function() { // DON'T EDIT BELOW THIS LINE var d = document, s = d.createElement('script'); s.src = 'https://YOUR-WEBSITE-HERE.disqus.com/embed.js'; s.setAttribute('data-timestamp', +new Date()); (d.head || d.body).appendChild(s); })(); </script> <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
Step 4: Make partial Blade File in Laravel
Once you have copy the code you will have to create a new partial and call it "disqus-comment.blade.php" and then paste the code in.
resources/views/partials/disqus-comment.blade.php
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable this.page.identifier = PAGE_IDENTIFIER;
this.page.url = '{{ url()->current() }}'; this.page.identifier = '{{ request()->path() }}'
Step 5: Include the Disqus to the page that you want to show it
Now you can include the Disqus partial to any of the pages you want to show the comment section. From your base file, you can write it like below.
@include('partials.disqus-comment')

Leave a reply