Adding comments to the website

Honestly, when I saw that they write about it and give advice to beginners on other sites, I was a little horrified and decided to create my own note on this topic without a "fatal flaw". Mostly, I saw long pieces of code that implement adding comments to a site. Usually, for this, a form is created, its processing, storage, and also selection for display are implemented. But the advantages of such an approach are diminishing over time.

In this note, you will learn one of the simplest (but subjectively one of the most preferred) ways to add comments to a site - a simple example for beginners + options for more advanced webmasters.

Indeed, why invent the bicycle and write a lot of code that will have to be maintained, fixed, etc. in the future, if there are plenty of ready-made solutions from third-party services (we are talking about social networks + disqus)?

But before we proceed to the implementation itself, let us consider the advantages/disadvantages of using ready-made solutions. (If I forgot something - write it in the comments - we will expand the list)

Advantages of third-party solutions:

  • Simplicity of implementation.
  • Protection against spam "out of the box" (in your solution, it would have to be implemented additionally, so it is theoretically related to the previous point).
  • Less prone to errors, bugs, etc., as third-party solutions have been tested by millions of users (again, it is related to the first point: you too can write everything without bugs, but additional time will be spent on debugging).
  • As a rule, services provide a ready-made admin panel, statistics, notifications for admins, sometimes moderation, multiple admins, pre-moderation, etc., the implementation of which by a webmaster, especially a beginner, can take months, if not years.
  • Users do not need to register, enter their name, etc. - it is assumed that they already have an account in a popular social network.
  • Most likely, it can withstand a high load due to the fact that social platforms are initially designed for high loads.

Disadvantages:

  • Scanty or complete absence of the possibility to change the appearance of the comments block.
  • Indexing in search engines.

As you can see, there are many advantages. The inability to change the appearance is most likely done in order to preserve the style of the comments service, thus creating unobtrusive advertising. (As one of the options). And as for indexing - how important is it, because far from all comments carry semantic load.