Tek Eye Logo

Tek Eye

Facebook Comments Plugin for CMS Web Publishing

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 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, plus a useful plugin is the Facebook comments code.

Facebook comments

Adding Facebook Comments to ↓markdown↓® CMS

At Tek Eye the lightweight ↓markdown↓ CMS (mdCMS) is used for easy website management and article publishing. mdCMS supports Disqus, it also supports the Facebook comments plugin (only one at a time can be used). How do you enable Facebook comments code in mdCMS? Three things are required for Facebook comments support on a web page:

  • The Facebook comments JavaScript code must be part of the 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 mdCMS

For a mdCMS 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 mdCMS articles that have the Comments header entry set to Yes. Only use one of the supported comments systems for mdCMS, i.e. if using the Faceboook comments plugin do not enable the support for Disqus.

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 mdCMS

For a mdCMS website just set Comments: Yes in the header for the page (see also Web Page Title Tag for more information on the mdCMS 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
*/

Facebook Comments

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.

See Also

Author:  Published:  

ShareSubmit to TwitterSubmit to FacebookSubmit to Google+Submit to LinkedInSubmit to redditPrint Page

markdown CMS Small Logo Icon ↓markdown↓ CMS is fast and simple. Build websites quickly and publish easily. For beginner to expert.



Articles on:

Android Programming and Android Practice Projects, HTML, VPS, Computing, IT, Computer History, ↓markdown↓ CMS, C# Programming, Using Windows for Programming



Free Android Projects and Samples:

Android Examples, Android List Examples, Android UI Examples