惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
美团技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
aimingoo的专栏
aimingoo的专栏
腾讯CDC
WordPress大学
WordPress大学
Apple Machine Learning Research
Apple Machine Learning Research
F
Fortinet All Blogs
G
Google Developers Blog
MongoDB | Blog
MongoDB | Blog
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
Engineering at Meta
Engineering at Meta
博客园_首页
B
Blog RSS Feed
D
Docker
M
MIT News - Artificial intelligence
爱范儿
爱范儿
I
InfoQ

Example blog

Ghost routing explained with routes.yaml examples — routes, collections & taxonomies Ghost redirects explained with practical redirects.yaml examples How to Serve JSON or XML Data in Ghost How to Change Your Default Post Template in Ghost Ghost Custom Theme Settings How to add Google Fonts to Ghost Themes How to Configure Ghost with Mailgun Ghost Theme Structure & Organization How to Make Custom Templates in Ghost Themes How to Install Ghost CMS via Ghost-CLI The best Ghost CMS hosting platforms Ghost 6.0 — Social Web and Native Ghost Analytics Ghost CMS Social web beta, email 2FA and more author social links How to keep custom design settings when updating your Ghost theme How to use the public preview card in Ghost How to add members-specific sections in Ghost How to customize the default content CTA in Ghost How to build a custom homepage in Ghost An overview of Ghost editor cards and and how they work Ghost CMS News: One-time payments & collecting sales tax How to customize the private site access template in Ghost How to add custom fonts in Ghost themes Ghost CMS News: Additional payment methods & internal linking How to use Code Injection in Ghost How to set meta data of your custom routes & collections in Ghost Ghost CMS News: TK reminders, ActivityPub and improvements How to format dates and use the date helper in Ghost Ghost CMS internationalization, custom fonts & spam protection Understanding and optimizing post and page settings in Ghost CMS Trigger the Ghost Portal popup based on page scroll progress
How to Add Facebook Comments to Ghost
Bright Themes · 2020-04-11 · via Example blog

Ghost doesn't come with a built-in comment system. We already made a tutorial how to add Disqus commenting system to your Ghost theme. If you prefer Facebook, you are in the right place as in this article I will show you how to setup Facebook comments in your Ghost theme.

Here are the steps to install the plugin:

Go to the Facebook comment configurator Fill out the

  • URL, This should be the blog url.
  • Width - The plugin width, either '100%' or a pixel value.
  • Number of Posts - The number of comments you want to show, when the plugin is first load. Press the Get Code button.

Two sections of code is generated. The first one is the JavaScript SDK, which should look like this:

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.0';
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

and

<div class="fb-comments" data-href="{{url absolute="true"}}" data-width="100%" data-numposts="5"></div>

Install the Plugin Code

Copy the SDK code and paste it right after the opening <body> tag, this should be found in the default.hbs file.

Then you have to copy the HTML code and place it wherever you want the plugin to appear on your page, usually that is post.hbs somewhere between the opening {{#post}} and closing {{/post}} helper.

Using the fb:comments-count value displays the number of comments on a given URL in a <span> element on your webpage. You can then use CSS to style this <span> element to match the rest of your website.

<span class="fb-comments-count" data-href="https://example.com/"></span> awesome
comments

To use the moderation tool, you either need to connect a Facebook account or a Facebook app to your comments plugin implementation.

To assign a Facebook account as admin of a comments plugin implementation, include the following meta element in the <head> section of the default.hbs file:

<meta property="fb:admins" content="{YOUR_FACEBOOK_USER_ID}" />

To add multiple moderators, add more than one element, each with one Facebook ID:

<meta property="fb:admins" content="{YOUR_FACEBOOK_USER_ID_1}" />
<meta property="fb:admins" content="{YOUR_FACEBOOK_USER_ID_2}" />

If you created the comment plugin using a Facebook App instead of adding accounts as admin you can set the following meta header.

<meta property="fb:app_id" content="{YOUR_APP_ID}" />

Restart Ghost.

Finally restart Ghost:

ghost restart

This is it, accessing a post you should see the Facebook comment section loading.

If you prefer Disqus to Facebook check out our tutorial on How to Add Disqus Comments to Ghost