Easy Social

Add social sharing widgets to your Drupal site with support for Twitter, Facebook, LinkedIn, Pinterest, and Email sharing.

easy_social
1,358 sites
22
drupal.org

Install

Drupal 11, 10, 9 v8.x-3.2
composer require 'drupal/easy_social:8.x-3.2'

Overview

Easy Social provides a simple yet powerful way to add social sharing buttons to your Drupal website. The module comes with built-in support for five major sharing platforms: Twitter, Facebook, LinkedIn, Pinterest, and Email sharing.

Each social widget can be individually configured with platform-specific options such as button size, layout style, language, and various display settings. The module offers flexible display options: widgets can be placed using blocks or displayed as pseudo-fields on supported entity types including nodes, comments, users, taxonomy terms, and files.

Easy Social is designed with extensibility in mind. Developers can easily create custom social sharing widgets by implementing hook_easy_social_widget() and providing corresponding theme templates. An example submodule is included to demonstrate how to create custom widgets.

Features

  • Twitter sharing widget with customizable via account, hashtags, count box position, button size, and Do Not Track option
  • Facebook Like/Share button with configurable layout style, color scheme, width, font, and action type (like or recommend)
  • LinkedIn sharing widget with share counter position and language settings
  • Pinterest Pin It button with customizable pin count display and description
  • Email sharing via mailto links with customizable subject line and email body
  • Block placement for displaying social widgets in any theme region
  • Entity pseudo-field integration for displaying widgets on nodes, comments, users, taxonomy terms, and files
  • Asynchronous JavaScript loading for improved page performance
  • Extensible widget system allowing developers to create custom social sharing widgets
  • Per-platform language settings for localized widget displays
  • Configurable through a tabbed administration interface

Use Cases

Blog content sharing

Add social sharing buttons to blog posts by placing the Easy Social block in the content region or enabling the Easy Social pseudo-field for the Article content type. Visitors can quickly share interesting articles to their social networks.

E-commerce product promotion

Enable social sharing on product pages to allow customers to share products they love. Pinterest integration is particularly valuable for visual products, while Facebook and Twitter help spread product awareness.

Newsletter sharing via Email

Use the Email widget to enable visitors to share page content via email with customized subject lines and body text. This is useful for B2B sites where email sharing may be more appropriate than social media.

Multi-language site localization

Configure language settings for Twitter and LinkedIn widgets to display in the visitor's preferred language, providing a more localized experience for international audiences.

Custom social network integration

Developers can create custom widgets for additional social networks or internal sharing systems by implementing hook_easy_social_widget() and following the example module pattern.

Tips

  • Enable asynchronous JavaScript loading (enabled by default) to prevent social widget scripts from blocking page rendering.
  • Use the entity pseudo-field display option to show sharing buttons only on full node views rather than teasers.
  • The Email widget works without any external JavaScript, making it the most privacy-friendly sharing option.
  • For Twitter, setting 'Do Not Track' respects visitor privacy preferences while still providing sharing functionality.
  • Customize the Facebook button to show 'recommend' instead of 'like' for content where recommendation language is more appropriate.
  • Check the Easy Social Example submodule in the contrib folder for detailed examples of creating custom widgets.

Technical Details

Admin Pages 6
Easy Social /admin/config/services/easy-social

Main settings page for configuring which social sharing widgets are enabled globally and advanced settings like asynchronous JavaScript loading.

Easy Social Twitter /admin/config/services/easy-social/twitter

Configure Twitter sharing widget settings including attribution, related accounts, hashtags, and display options.

Easy Social FaceBook /admin/config/services/easy-social/facebook

Configure Facebook Like/Share button settings including layout, appearance, and action type.

Easy Social LinkedIn /admin/config/services/easy-social/linkedin

Configure LinkedIn sharing widget settings including counter display and language.

Easy Social Pinterest /admin/config/services/easy-social/pinterest

Configure Pinterest Pin It button settings including pin count display and content.

Easy Social Email /admin/config/services/easy-social/email

Configure email sharing widget settings including button appearance and default email content.

Permissions 1
Administer Easy Social

Change settings for the Easy Social module. This permission should be restricted to trusted administrators.

Hooks 3
hook_easy_social_widget

Define custom Easy Social widgets. Each widget must have a corresponding theme implementation named 'easy_social_$WIDGET' where $WIDGET is the widget's machine_name.

hook_easy_social_widget_alter

Alter Easy Social widget definitions before they are used. Allows modifying or removing widgets defined by other modules.

hook_easy_social_supported_entity_alter

Alter the list of entity types that support the Easy Social pseudo-field. By default, only core entity types are supported.

Troubleshooting 4
Social widgets not appearing

Ensure widgets are enabled in the global settings at /admin/config/services/easy-social. Then either place the Easy Social block in a visible region or enable the Easy Social pseudo-field in the entity's Manage Display settings.

Facebook Like button not working

The Facebook SDK requires the page to be publicly accessible. Ensure your site is not behind authentication or on localhost. Also check browser console for any JavaScript errors or content security policy issues.

Pinterest button not pinning the correct image

Configure a default image URL in the Pinterest settings, or ensure your page has proper Open Graph meta tags that Pinterest can detect.

Widget styles not matching site theme

Override the easy_social templates in your theme's templates directory. The base CSS in css/easy_social.css can also be overridden through your theme's CSS.

Security Notes 4
  • The 'administer easy_social' permission is marked as restricted and should only be granted to trusted administrators.
  • Social widgets load external JavaScript from third-party platforms (Twitter, Facebook, LinkedIn, Pinterest) which may track user behavior.
  • Consider privacy implications when using social widgets. The Twitter 'Do Not Track' option provides some privacy protection.
  • The Email widget uses mailto links and does not transmit data to external servers, making it the most privacy-conscious option.