diff --git a/client/views/facebook/facebook.coffee b/client/views/facebook/facebook.coffee index 5a8a5cf..c872cfb 100644 --- a/client/views/facebook/facebook.coffee +++ b/client/views/facebook/facebook.coffee @@ -4,19 +4,30 @@ Template.shareit_facebook.rendered = -> @autorun -> template = Template.instance() data = Template.currentData() - - $('meta[property^="og:"]').remove() + # console.log(data) + + noMeta=data.url && (data.url!=(location.origin + location.pathname)) + # console.log(data.url) + # console.log((location.origin + location.pathname)) + if not noMeta + $('meta[property^="og:"]').remove() # # OpenGraph tags # description = data.facebook?.description || data.excerpt || data.description || data.summary url = data.url || location.origin + location.pathname title = data.title - $('', { property: 'og:type', content: 'article' }).appendTo 'head' - $('', { property: 'og:site_name', content: location.hostname }).appendTo 'head' - $('', { property: 'og:url', content: url }).appendTo 'head' - $('', { property: 'og:title', content: title }).appendTo 'head' - $('', { property: 'og:description', content: description }).appendTo 'head' + + if not noMeta + $('', { property: 'og:type', content: 'article' }).appendTo 'head' + if not noMeta + $('', { property: 'og:site_name', content: location.hostname }).appendTo 'head' + if not noMeta + $('', { property: 'og:url', content: url }).appendTo 'head' + if not noMeta + $('', { property: 'og:title', content: title }).appendTo 'head' + if not noMeta + $('', { property: 'og:description', content: description }).appendTo 'head' if data.thumbnail if typeof data.thumbnail == "function" @@ -27,7 +38,8 @@ Template.shareit_facebook.rendered = -> if not /^http(s?):\/\/+/.test(img) img = location.origin + img - $('', { property: 'og:image', content: img }).appendTo 'head' + if not noMeta + $('', { property: 'og:image', content: img }).appendTo 'head' if ShareIt.settings.sites.facebook.appId? template.$('.fb-share').click (e) -> diff --git a/client/views/googleplus/googleplus.coffee b/client/views/googleplus/googleplus.coffee index 95b4665..05762ec 100644 --- a/client/views/googleplus/googleplus.coffee +++ b/client/views/googleplus/googleplus.coffee @@ -4,7 +4,10 @@ Template.shareit_googleplus.rendered = () -> @autorun -> template = Template.instance() data = Template.currentData() - $('meta[itemscope]').remove() + noMeta=data.url && (data.url!=(location.origin + location.pathname)) + + if not noMeta + $('meta[itemscope]').remove() # # Schema tags @@ -13,10 +16,14 @@ Template.shareit_googleplus.rendered = () -> url = data.url || location.origin + location.pathname title = data.title itemtype = data.googleplus?.itemtype || 'Article' - $('html').attr('itemscope', '').attr('itemtype', "http://schema.org/#{itemtype}") - $('', { itemprop: 'name', content: location.hostname }).appendTo 'head' - $('', { itemprop: 'url', content: url }).appendTo 'head' - $('', { itemprop: 'description', content: description }).appendTo 'head' + if not noMeta + $('html').attr('itemscope', '').attr('itemtype', "http://schema.org/#{itemtype}") + if not noMeta + $('', { itemprop: 'name', content: location.hostname }).appendTo 'head' + if not noMeta + $('', { itemprop: 'url', content: url }).appendTo 'head' + if not noMeta + $('', { itemprop: 'description', content: description }).appendTo 'head' if data.thumbnail if typeof data.thumbnail == "function" @@ -27,7 +34,8 @@ Template.shareit_googleplus.rendered = () -> if not /^http(s?):\/\/+/.test(img) img = location.origin + img - $('', { itemprop: 'image', content: img }).appendTo 'head' + if not noMeta + $('', { itemprop: 'image', content: img }).appendTo 'head' # # Google share button # diff --git a/client/views/pinterest/pinterest.coffee b/client/views/pinterest/pinterest.coffee index 8771643..d3ad428 100644 --- a/client/views/pinterest/pinterest.coffee +++ b/client/views/pinterest/pinterest.coffee @@ -4,6 +4,7 @@ Template.shareit_pinterest.rendered = -> @autorun -> template = Template.instance() data = Template.currentData() + noMeta=data.url && (data.url!=(location.origin + location.pathname)) preferred_url = data.url || location.origin + location.pathname url = encodeURIComponent preferred_url diff --git a/client/views/twitter/twitter.coffee b/client/views/twitter/twitter.coffee index 7e91f6d..032d3b2 100644 --- a/client/views/twitter/twitter.coffee +++ b/client/views/twitter/twitter.coffee @@ -4,7 +4,10 @@ Template.shareit_twitter.rendered = -> @autorun -> template = Template.instance() data = Template.currentData() - $('meta[property^="twitter:"]').remove() + noMeta=data.url && (data.url!=(location.origin + location.pathname)) + + if not noMeta + $('meta[property^="twitter:"]').remove() if data.thumbnail if typeof data.thumbnail == "function" @@ -19,18 +22,24 @@ Template.shareit_twitter.rendered = -> # Twitter cards # - $('', { property: 'twitter:card', content: 'summary' }).appendTo 'head' + if not noMeta + $('', { property: 'twitter:card', content: 'summary' }).appendTo 'head' # What should go here? #$('', { property: 'twitter:site', content: '' }).appendTo 'head' if data.author - $('', { property: 'twitter:creator', content: data.author }).appendTo 'head' + if not noMeta + $('', { property: 'twitter:creator', content: data.author }).appendTo 'head' description = data.twitter?.description || data.excerpt || data.description || data.summary - $('', { property: 'twitter:url', content: location.origin + location.pathname }).appendTo 'head' - $('', { property: 'twitter:title', content: "#{data.title}" }).appendTo 'head' - $('', { property: 'twitter:description', content: description }).appendTo 'head' - $('', { property: 'twitter:image', content: img }).appendTo 'head' + if not noMeta + $('', { property: 'twitter:url', content: location.origin + location.pathname }).appendTo 'head' + if not noMeta + $('', { property: 'twitter:title', content: "#{data.title}" }).appendTo 'head' + if not noMeta + $('', { property: 'twitter:description', content: description }).appendTo 'head' + if not noMeta + $('', { property: 'twitter:image', content: img }).appendTo 'head' # # Twitter share button diff --git a/package.js b/package.js index 1c5884a..67834cd 100644 --- a/package.js +++ b/package.js @@ -7,7 +7,7 @@ Package.describe({ Package.onUse(function(api) { api.versionsFrom("METEOR@1.0"); - api.use(['coffeescript', 'less', 'templating', 'underscore', 'jquery'], 'client'); + api.use(['coffeescript', 'less@2.5.0_1', 'templating', 'underscore', 'jquery'], 'client'); api.use(['fortawesome:fontawesome@4.2.0'], 'client'); api.imply('spiderable', ['client', 'server']); diff --git a/versions.json b/versions.json index c5914e7..b432fd2 100644 --- a/versions.json +++ b/versions.json @@ -78,7 +78,7 @@ ], [ "less", - "1.0.11" + "2.5.0_1" ], [ "logging",