In this article, I’d like to share with you a module that I’ve recently created for Drupal 7 and 8 called Facebook Comments Block. It gives visitors of your website the opportunity to comment on your site’s content using a widget that is directly integrated with Facebook. Here is the screenshot showing you how the commenting box will be displayed on your website:
What was missing in other Drupal commenting modules?
The historical background of my contribution to the Drupal society was pretty easy. While working on Vardot’s distribution Uber Publisher our main goal was to make Drupal as user-friendly as possible. One of the increasing users’ convenience factors was a maximal easiness in adding comments on the website, and one of the main satisfaction criteria from the user's perspective is the number of clicks and the total time needed to proceed with a request.
The big UX disadvantage of popular solutions is that users are required to create an account on a new website. The number of services we are using is increasing every year, and managing, remembering passwords or even logging in to all of them becomes very time-consuming. As a site visitor I’d prefer to be able to comment on posts without signing up, because otherwise if I read several blogs, I waste too much time for nothing.
Another important disadvantage of commenting widgets I worked with (this time more for a developer and site owner than for an end-user) was that most of them were based on URL aliases. As a result, some of our clients were facing the issue when they were losing all comments after changing the URL of the page or its title (in Uber Publisher short SEO-friendly URLs are generated automatically based on the title of the post).
What are the advantages of Facebook Comments Block module?
Addressing issues that were described above, and adding some new benefits, I’ve made a list of reasons why you may go for the Facebook Comments Block module:
1. Facebook Comments Block relies on a node ID
The widget minimizes risks of changing the URL because it relies on a node ID that is always constant. As a result, even if you rewrite the title of your article or the link of the page, comments that were added before won’t be lost.
2. Facebook Comments Block allows for the main domain configuration
If you have multiple domains associated with your website, you can configure the module to recognize the main domain and share comments across all domains. For example, we have two URLs for the same site -
www.myexample.com/article-title. Configure Facebook Comments Block to use
www.example.com as the main domain, and comments of the main domain will be shared to and from
3. Facebook Comments Block uses basic configurations
It doesn’t have dependencies which makes it easy to install and use. Just go to "Admin" -> "Structure" -> "Block", and you’ll find "Facebook Comments" settings. Choosing “Configure” you’ll see the menu with options to customize the widget:
4. You don’t need to log in
Most of the site visitors are already logged in with their Facebook profiles. As a result, they comment using their real social media (Facebook) account and don’t need to make additional clicks to be able to comment. The idea of this widget is to be organically implemented to the page and be perceived as its natural part, so the visitor doesn’t even realize that there is a special block for commenting that is connected to an external service.
5. Facebook Comments Block is easy to integrate with other modules
The widget uses Drupal block API, so it can be easily integrated with most of the Drupal modules that support blocks (i.e. Rules, Context, Panels, …etc.). The integration is straightforward and doesn’t require any additional development efforts or customization.
Porting Facebook Comments Block to Drupal 8
Facebook Comments Block was a new step in my developer’s career because it introduced me to the world of Drupal 8. After D8 release I’ve decided to learn it by porting this block and use Drupal 8’s new block API, block configurations, and the new twig templates to apply changes to my new module. Now the widget is available in two latest Drupal versions - D7 and D8. It can be used by site owners that already realized benefits of Drupal 8 as well as by site owners that prefer to wait, evaluate, and choose.
The usage statistics of the widget shows that the number of people installing it is constantly growing and reached 380 sites by the beginning of June:
Drupal modules are developed by the community and grown by the community. If you’d like to try the Facebook Comments Block, feel free to download it from drupal.org. To report any bug issue, support or feature request you can fill a new ticket on Drupal issue queue. And of course, I would be really thankful if you share this blog post in your social networks, so more interested people could learn about the widget and try it out.
- Drupal Planet
- Drupal 8