From 25dc4bbaf368b377ee0b0de61ca70a8beeb5fbba Mon Sep 17 00:00:00 2001 From: Tom Vincent Date: Sun, 27 May 2012 19:19:51 +0100 Subject: [PATCH 1/6] Initial outlining for sharing providers --- _config.yml | 6 +++++- _includes/JB/sharing | 23 +++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/_config.yml b/_config.yml index 6e69e228a0..7675d6694b 100644 --- a/_config.yml +++ b/_config.yml @@ -111,7 +111,11 @@ JB : # Set 'provider' to false to turn sharing off globally. # sharing : - provider : false + enabled : true + provider : + twitter : true + facebook : true + google-plus: true # Settings for all other include helpers can be defined by creating # a hash with key named for the given helper. ex: diff --git a/_includes/JB/sharing b/_includes/JB/sharing index f5b11518bd..9c99d699da 100644 --- a/_includes/JB/sharing +++ b/_includes/JB/sharing @@ -1,8 +1,19 @@ -{% if site.safe and site.JB.sharing.provider and page.JB.sharing != false %} +{% if site.JB.sharing.enabled %} -{% case site.JB.sharing.provider %} -{% when "custom" %} - {% include custom/sharing %} -{% endcase %} + {% capture sharing_url %}{{ site.production_url }}{{ page.url }}/{% endcapture %} + {% capture sharing_prefix %}Share "{{ page.title }}" on{% endcapture %} -{% endif %} \ No newline at end of file + {% if site.JB.sharing.provider.twitter %} + {% capture sharing_title %}{{ sharing_prefix }} Twitter{% endcapture %} + {% include JB/sharing-providers/twitter %} + {% endif %} + {% if site.JB.sharing.provider.facebook %} + {% capture sharing_title %}{{ sharing_prefix }} Facebook{% endcapture %} + {% include JB/sharing-providers/facebook %} + {% endif %} + {% if site.JB.sharing.provider.google-plus %} + {% capture sharing_title %}{{ sharing_prefix }} Google Plus{% endcapture %} + {% include JB/sharing-providers/google-plus %} + {% endif %} + +{% endif %} From 806a3623e8eb5e58c3165633e44fc36fc353f5fb Mon Sep 17 00:00:00 2001 From: Tom Vincent Date: Sun, 27 May 2012 18:26:14 +0100 Subject: [PATCH 2/6] Add twitter sharing provider includes, stub others --- _includes/JB/sharing-providers/facebook | 1 + _includes/JB/sharing-providers/google-plus | 1 + _includes/JB/sharing-providers/twitter | 4 ++++ 3 files changed, 6 insertions(+) create mode 100644 _includes/JB/sharing-providers/facebook create mode 100644 _includes/JB/sharing-providers/google-plus create mode 100644 _includes/JB/sharing-providers/twitter diff --git a/_includes/JB/sharing-providers/facebook b/_includes/JB/sharing-providers/facebook new file mode 100644 index 0000000000..c6bcb6cceb --- /dev/null +++ b/_includes/JB/sharing-providers/facebook @@ -0,0 +1 @@ +
  • diff --git a/_includes/JB/sharing-providers/google-plus b/_includes/JB/sharing-providers/google-plus new file mode 100644 index 0000000000..9cc60eac6a --- /dev/null +++ b/_includes/JB/sharing-providers/google-plus @@ -0,0 +1 @@ +
  • diff --git a/_includes/JB/sharing-providers/twitter b/_includes/JB/sharing-providers/twitter new file mode 100644 index 0000000000..7222f10b1f --- /dev/null +++ b/_includes/JB/sharing-providers/twitter @@ -0,0 +1,4 @@ +
  • From c8193855b783739b0564422b5cca275362e0de94 Mon Sep 17 00:00:00 2001 From: Tom Vincent Date: Sun, 27 May 2012 18:36:12 +0100 Subject: [PATCH 3/6] Add sharing title, DRY Conflicts: _includes/JB/sharing --- _includes/JB/sharing | 4 ++-- _includes/JB/sharing-providers/twitter | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/_includes/JB/sharing b/_includes/JB/sharing index 9c99d699da..e18ec1f28a 100644 --- a/_includes/JB/sharing +++ b/_includes/JB/sharing @@ -1,10 +1,10 @@ {% if site.JB.sharing.enabled %} {% capture sharing_url %}{{ site.production_url }}{{ page.url }}/{% endcapture %} - {% capture sharing_prefix %}Share "{{ page.title }}" on{% endcapture %} + {% capture sharing_title %}Share "{{ page.title }}" on{% endcapture %} {% if site.JB.sharing.provider.twitter %} - {% capture sharing_title %}{{ sharing_prefix }} Twitter{% endcapture %} + {% capture sharing_title %}{{ sharing_title }} Twitter{%endcapture %} {% include JB/sharing-providers/twitter %} {% endif %} {% if site.JB.sharing.provider.facebook %} diff --git a/_includes/JB/sharing-providers/twitter b/_includes/JB/sharing-providers/twitter index 7222f10b1f..88d37a6b6c 100644 --- a/_includes/JB/sharing-providers/twitter +++ b/_includes/JB/sharing-providers/twitter @@ -1,4 +1,5 @@
  • +&url={{ sharing_url }}' title='{{ sharing_title }}'> + From a8b568e6e372abff93a8d5833b0ab0000c54ada4 Mon Sep 17 00:00:00 2001 From: Tom Vincent Date: Sun, 27 May 2012 19:09:41 +0100 Subject: [PATCH 4/6] Add usage, facebook and GPlus providers Conflicts: _includes/JB/sharing --- _includes/JB/sharing | 21 ++++++++++++++++++--- _includes/JB/sharing-providers/facebook | 4 +++- _includes/JB/sharing-providers/google-plus | 4 +++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/_includes/JB/sharing b/_includes/JB/sharing index e18ec1f28a..5bd9ff260a 100644 --- a/_includes/JB/sharing +++ b/_includes/JB/sharing @@ -1,10 +1,25 @@ -{% if site.JB.sharing.enabled %} +{% comment %}{% endcomment %} + +{% if site.JB.sharing %} {% capture sharing_url %}{{ site.production_url }}{{ page.url }}/{% endcapture %} - {% capture sharing_title %}Share "{{ page.title }}" on{% endcapture %} + {% capture sharing_prefix %}Share "{{ page.title }}" on{% endcapture %} {% if site.JB.sharing.provider.twitter %} - {% capture sharing_title %}{{ sharing_title }} Twitter{%endcapture %} + {% capture sharing_title %}{{ sharing_prefix }} Twitter{% endcapture %} {% include JB/sharing-providers/twitter %} {% endif %} {% if site.JB.sharing.provider.facebook %} diff --git a/_includes/JB/sharing-providers/facebook b/_includes/JB/sharing-providers/facebook index c6bcb6cceb..cf0b523d96 100644 --- a/_includes/JB/sharing-providers/facebook +++ b/_includes/JB/sharing-providers/facebook @@ -1 +1,3 @@ -
  • +
  • + diff --git a/_includes/JB/sharing-providers/google-plus b/_includes/JB/sharing-providers/google-plus index 9cc60eac6a..a65ed16cfc 100644 --- a/_includes/JB/sharing-providers/google-plus +++ b/_includes/JB/sharing-providers/google-plus @@ -1 +1,3 @@ -
  • +
  • + From fa6ca6f84b185c397984754ba801f08129ec2183 Mon Sep 17 00:00:00 2001 From: Tom Vincent Date: Sun, 27 May 2012 20:08:40 +0100 Subject: [PATCH 5/6] Fix sharing message variable --- _includes/JB/sharing-providers/twitter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/JB/sharing-providers/twitter b/_includes/JB/sharing-providers/twitter index 88d37a6b6c..1e7cdc630f 100644 --- a/_includes/JB/sharing-providers/twitter +++ b/_includes/JB/sharing-providers/twitter @@ -1,5 +1,5 @@
  • From 8b1856814f9cfb11e50b31b437f4cba82f75cfcc Mon Sep 17 00:00:00 2001 From: Tom Vincent Date: Sun, 27 May 2012 20:02:17 +0100 Subject: [PATCH 6/6] Add context variable doc, fix ordering Conflicts: _includes/JB/sharing --- _includes/JB/sharing | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/_includes/JB/sharing b/_includes/JB/sharing index 5bd9ff260a..0f374556eb 100644 --- a/_includes/JB/sharing +++ b/_includes/JB/sharing @@ -1,8 +1,11 @@ {% comment %}{% endcomment %} -{% if site.JB.sharing %} +{% if site.JB.sharing.enabled %} + + {% if sharing_context %} + {% assign page = sharing_context %} + {% endif %} {% capture sharing_url %}{{ site.production_url }}{{ page.url }}/{% endcapture %} {% capture sharing_prefix %}Share "{{ page.title }}" on{% endcapture %}