Facebook Comments Plugin for CMS Web Publishing
Update: Support for the Facebook Comments plugin has been removed from the ↓markdown↓® CMS (md-CMS) code. This is because the Facebook comments plugin operation does not match its developer documentation. If you want to see how the Facebook comments plugin was integrated into the md-CMS code look at the md-CMS version history on the GitHub project page. The files removed are md-comment.php, md-fb-admin.php, and md-fb-comms.txt. This article remains for archive purposes only.
Using a Content Management System (CMS) to run and publish a website makes sense. A CMS makes website maintenance and article publishing easier, freeing up time for other tasks, such as Search Engine Optimization (SEO). One part of SEO, and improving the website presence, is to allow people to comment on articles. However, allowing article comments can be a pain, due to spamming, trolling and other unwanted entries. One way to help manage comments is to use a third-party commenting systems that can verify the people that are posting comments, and filter out a lot of the troublesome comment content. One such platform is Disqus (though the free version is bloated by advertising), plus a useful plugin is the Facebook comments code.
Adding Facebook Comments to ↓markdown↓® CMS
At Tek Eye the lightweight ↓markdown↓ CMS (md-CMS) is used for easy website management and article publishing. md-CMS supports the Facebook comments plugin (only one at a time can be used). How do you enable Facebook comments code in md-CMS? Three things are required for Facebook comments support on a web page:
- The web page's URL must be embedded in the Facebook comments code.
- A Facebook comments app id for moderation must be assigned to the web page.
The Facebook Comments Moderation App Id
To enable the Facebook comments on a web page to be moderated use the fb:app_id web page meta data property:
<meta property="fb:app_id" content="YOUR_APP_ID" />
Where YOUR_APP_ID is a long string of number, e.g. 123456789012345. To get an app id go to the Facebook for developers pages. You have to be logged into Facebook and have created a developer account. On the developer pages, under My Apps select Add New App. Once the Facebook app for the comments has been created the app id (a long string of numbers) can be copied. This app id is then added to the content attribute in the meta tag, in the head section, for each web page displaying the Facebook comments plugin.
Enabling the Facebook App Id in md-CMS
For a md-CMS based website modify the configuration file site-config.php in the root directory. (To see how to create the site-config.php file see the article Website Home Page for ↓markdown↓ CMS.) The FBK_ADMIN entry needs to be added to the configuration file. Use your website's control panel and edit the site-config.php file. Add the entry FBK_ADMIN in the $MD_SETTINGS array, setting the value to the Facebook app-id for your website. For example if the app id was 123456789012345 the entry in the $MD_SETTINGS array is
"FBK_ADMIN" => "123456789012345", i.e.:
. . . "FBK_ADMIN" => "123456789012345", "XML_SITEMAP_REFRESH" => "-1 week" );
Once the updated configuration file is saved on the web server the Facebook comments plugin is enabled for all md-CMS articles that have the Comments header entry set to Yes. It is recommended to use one comments systems for md-CMS for a consistent user experience.
Enabling the Facebook Comments Code on a Web Page
The Facebook comments script is availble from the Comments Plugin Code Generator on the Comments Plugin page. Enter the URL for the web page in the configurator and press the get Get Code button. The displayed code is copied into the web page just after the HTML body tag. The displayed div is placed into the web page where the comments section should appear.
Enabling the Facebook Comments Code in md-CMS
For a md-CMS website just set
Comments: Yes in the header for the page (see also Web Page Title Tag for more information on the md-CMS page header. The Facebook comments code and webpage URL is added automatically (assuming the FBK_ADMIN has been configured):
/* Title: A Web Page Title Comments: Yes */
Problems Posting Facebook Comments when Testing
When testing the newly added Facebook comments plugin on your development computer, you may have trouble posting comments. For example the comment may fail to post and a message displaying This content is no longer available is seen. If this happens try clearing the browser cookies. If you want to keep your cookies intact, or if clearing cookies does not work, try posting from a different device. Alternatively, get another Facebook user to post a test comment.
Using the Facebook Comments Moderation Tool
Use the Facebook for developers tool for moderation. Select the app created for the website, then use the Tools menu and View All Tools. Then select the Comments Moderation Tool to view the comments moderation functions.
- For more md-CMS tutorials see the list in the article Build a Website from Scratch with ↓markdown↓ CMS
- For a full list of all the articles in Tek Eye see the full site Index.
Author:Daniel S. Fowler Published: Updated: