How to Install ShareThis’ Tools on Drupal
Installing ShareThis Tools with Javascript Code
- Log in or Sign up to the ShareThis Platform.
- Select the ShareThis tool you would like to use and activate it by clicking the Enable tool button.
- Then, customize the buttons by selecting your social channels, size, and shape.
- Select the Activate code button in the top right corner. In the pop-up, click the Copy code button.
- Log in to your Drupal website.
- For convenience, you could install and Activate the Header and Footer Scripts plugin to insert the script code:
- Navigate to Configuration page: Administer > Configuration > Development > Header Footer Scripts Page.
- Paste the code from Step 4 into Header Scripts.
- Click on Save Configurations.
Adding Inline ShareThis Tools
Inline tools require an extra snippet of code to work on your site. If you would like to install our Inline Share Buttons, Follow Buttons, Reaction Buttons, or Social Feed tools on your website, you will need to add a placement code wherever you want the tool to appear. To learn more about ShareThis Website tools, go here.
You can choose between:
- Installing ShareThis tools on every newly created post (Editing the theme code)
- Installing ShareThis tools on a specific article or post (Editing a specific article or post)
Editing the Theme Code
- In your ShareThis Platform, select the ShareThis tool you want to use and copy the placement code. Depending on the tool you are installing, the code should look similar to this:
<div class="sharethis-inline-share-buttons"></div>
- Log in to your Drupal website.
- In the Manage administrative menu, navigate to Structure > Block layout > Custom block library (admin/structure/block/block-content).
- Click Add custom block.
- Name the block. Inside the Body, toggle the Source as HTML Code and place the ShareThis placement code.
- Click Save.
- Go to Block Layout and place the newly created blog wherever you want your buttons to appear.
- Click on Save Blocks.
Editing a specific article or post
- Create an article.
- In the body of the article, toggle the Source as HTML Code.
- Place the ShareThis placement code wherever you want it to appear in your article/post.
- Click Save.