Add a like button to a Ghost blog
Ghost has no like or clap button of its own. Load the script once with Code injection, then place the button in your theme, or in the posts you choose.
Before you start: get a key
- Sign in with GitHub on the dashboard and add your site.
-
Create a button. In its allowed origins, list every address your site
is served from, one per line and without a path, such as
https://example.com. Add the address you preview on locally too, exactly as the browser shows it. A page on an origin that is not listed cannot load the button, so nobody else can use your key. -
Copy the key. It starts with
pk_. Below, it stands in aspk_YOUR_BUTTON_KEY.
1. Load the script on every page
In Ghost Admin, go to Settings → Code injection and add this to Site footer:
<script src="https://appreciate-button.com/widget.js" async></script>
2a. Under every post: edit the theme
Download your theme (Settings → Design → Change theme), open
post.hbs, and add the element right after {{ content }}:
<appreciate-button data-key="pk_YOUR_BUTTON_KEY"></appreciate-button>
Zip the theme again and upload it on the same screen.
2b. On chosen posts: an HTML card
No theme to edit: in the post editor, add an HTML card where the button should go and paste the same element. Each post counts separately.
Check it
Open a post on the live site. If the button shows an error, add your blog's address to the
button's allowed origins. A local Ghost install runs at
http://localhost:2368.