Skip to content

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

Notifications You must be signed in to change notification settings

lukemadera/meteor-social-share

Repository files navigation

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);

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published