Share Links
Simple non-API share links for:
- Mail page
- Print page
No platform specific JavaScript required (e.g. Facebook SDK).
Styling is not provided!
Currently requires jQuery.
Installation
npm install --save gwa-share-linksbower install --save gwa-share-links
Usage
<a href="http://linkto.share.com/" class="fb-share">Share on Facebook</a><a href="http://linkto.share.com/" data-content="#hashtag content" class="tw-share">Share on Twitter</a><a href="#" class="wa-share">Share on Whatsapp</a><a href="http://linkto.share.com/" data-content="My message" class="wb-share">Share on Weibo</a> <a href="#" class="share" data-type="linkedin">Share on LinkedIn</a><a href="#" class="share" data-type="xing">Share on Xing</a><a href="#" class="share" data-type="print">Print</a> <a href="#" class="mail">Mail</a>
gwaShareLinks;gwaShareLinks;gwaShareLinks;gwaShareLinks; // Init multiple that have the `data-type` attribute.gwaShareLinks; // Init by passing type as 2nd argument.gwaShareLinks;
You can also use data-type
to set the type, and then init all in one call:
<a href="#" class="share" data-type="facebook">Share on Facebook</a><a href="#" class="share" data-type="twitter">Share on Twitter</a>
gwaShareLinks;
URLs
Set a custom URL by adding the href
, or set to #
to use the page location.
Titles
Some sharers, e.g. Twitter or Mail, use text content.
The order of preference is as follows:
data-content
attributeog:title
metatag- the page
title
This means that you can use data-content
to add hashtags to a Twitter share.