Whether websites use Disqus plugins or just manually embed the script, the system is loaded onto the page in generally the same way.
When a user visits a webpage that includes Disqus (for example, a blog post), the page makes a request to Disqus. Disqus uses the information defined on the page, called configuration variables, to locate the correct thread. Disqus will look up the associated thread and, if found, embed the correct threads with all the right comments onto the page. If an associated thread was not found, Disqus will create a new page with the data provided (again, in the configuration variables), and environment metadata such as page URL, page title, and current datetime.
An awesome tool that will help you to solve the problem of create tables in your database project handling the user-comments-blog relations and you may want to implement as soon as possible.
Register your website in Disqus
We suppose that you already have a Disqus account, now go the the register site area and fill the formular. After the registration of your website, go to the admin panel of disqus.
Choose a website and choose a platform to install, in this case select the Universal Code.
The Disqus website will show you the HTML code that you need to append in your website, i.e :
Note: use twig to easily retrieve the canonical url of the page. Remember that the following script needs to be generated by the Disqus website, you only need to change the values of the
- identifier : needs to be the relative url path of the page where the comments needs to be loaded, identified as an id in the disqus database.
- url : the canonical path to the website where the comments will be loaded (