mdBook
How to embed LikeCoin button into mdBook
Thanks to the user ιε ΄ι€θζ© for providing the tutorial.
Before adding the LikeCoin button, please register a Liker ID.
Follow the steps below:
Use JavaScript to create the HTML: In the browser, create the following HTML structure and put it into the static HTML created by mdBook:
Add the likebutton.js
: Place a file named likebutton.js
next to book.toml
in your custom-made mdBook. You can also use sdk.js
from the likecoin/likecoin-button-sdk, as it works the same.
Here's an example of the likebutton.js code:
Copy and modify the CSS: Copy the LikeCoinButton-integration/style.css file and rename it to become likebutton.css
. Make the following modifications:
Edit the book.toml
: Open the book.toml
and add the following lines under the output.html
section:
Add the LikeCoin button to specific pages: In your markdown (md) files, add a <div> element with the class "likebutton" where you want the LikeCoin button to appear. For example:
The above instructions are for a single Liker ID. If you want to support multiple users, you can achieve it by using getElementsByClassName(LikerIDFoo).
Remember to build the mdBook and preview your website to see the LikeCoin button in action.
Last updated