Skip to content

Latest commit

 

History

History
70 lines (51 loc) · 1.4 KB

README.md

File metadata and controls

70 lines (51 loc) · 1.4 KB

lukemadera:social-share

Cross platform (inc. Cordova) social sharing for facebook, twitter, pinterest

Demo

Demo

Source

Dependencies

[none]

Installation

In a Meteor app directory:

meteor add lukemadera:social-share

Usage

{{> lmSocialShare opts=opts}}
if(Meteor.isClient) {
  Template.socialShareBasic.helpers({
    opts: function() {
      var opts ={
        facebook: true,
        twitter: true,
        pinterest: false,
        shareData: {
          url: 'http://google.com'
        },
        buttonHtml: {
          twitter: 'Twitter'
        }
      };
      return opts;
    }
  });
}

Then create your meta tags as needed. An example Iron.router meta tag script is in router-social.js. You can test your meta tags with the Chrome Inspector by spoofing the User Agent to Facebot or Twitterbot.

For Cordova, add access rules to allow the links:

// Social sharing
App.accessRule('*://*.facebook.com/*');
App.accessRule('*://*.fbcdn.net/*');
App.accessRule('*://*.gmail.com/*');
App.accessRule('*://*.google.com/*');
App.accessRule('*://*.linkedin.com/*');
App.accessRule('*://*.pinterest.com/*');
App.accessRule('*://*.twitter.com/*');

//App.accessRule('mailto:*', true);
//App.accessRule('sms:*', true);