By default Articles, Pages, Blog pages, and other content types do not have a place for visitors to leave a comment. Beginning in Drupal 8, Comment became its own field type. This means it is much more versatile and can be added to even more places, such as each product on a site having its own comment section. Below is our guide on adding a comment field for the content type in Drupal 8.
How to create a comment field for a content type
- Log into your admin interface.
Select the Menu option from the top menu bar.
From here click on the the Structure link, located on the menu bar underneath the first one.
You are now on the Structure page. From here, find and click on the Content types link.
Here on the Content types page you are presented with all the available types of content to create nodes with. Find the content type you want to add the comment to and click on the Message fields link from the dropdown. In our example, we will choose the Blog page content type.
This page is where we will add the comment field. Give the comment field a name where you see Add new field. This should be descriptive, so we are naming it Comments. Note that the Machine Name is automatically created according to the label you gave the field. Next, select the Comments option from the Field Type dropdown.
After the field data has been entered, click on the Save button in the lower left corner. This will save the new field data to your selected content type. You will be prompted to confirm this with an additional page, simply click Save field settings to finish.
Congratulations, now you know how to create a comment field in Drupal. In the next guide, we’ll cover Customizing your Comments field in Drupal 8.