From 9164c5053d6e05379468de3b8a1f510ceffc7d76 Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Mon, 7 Mar 2016 11:29:35 -0500 Subject: [PATCH] Add more analytics and commenting options --- _config.yml | 16 ++++++++++++-- _includes/analytics | 12 ++++++++++ _includes/analytics-providers/custom | 3 +++ _includes/analytics-providers/google | 11 ++++++++++ .../analytics-providers/google-universal | 9 ++++++++ _includes/comments | 14 ++++++++++++ _includes/comments-providers/custom | 3 +++ _includes/comments-providers/disqus | 22 +++++++++++++++++++ _includes/comments-providers/facebook | 8 +++++++ _includes/comments-providers/google-plus | 2 ++ _includes/disqus-comments | 22 ------------------- _includes/scripts | 18 ++------------- _layouts/single.html | 13 +++++++++-- 13 files changed, 111 insertions(+), 42 deletions(-) create mode 100644 _includes/analytics create mode 100644 _includes/analytics-providers/custom create mode 100644 _includes/analytics-providers/google create mode 100644 _includes/analytics-providers/google-universal create mode 100644 _includes/comments create mode 100644 _includes/comments-providers/custom create mode 100644 _includes/comments-providers/disqus create mode 100644 _includes/comments-providers/facebook create mode 100644 _includes/comments-providers/google-plus delete mode 100644 _includes/disqus-comments diff --git a/_config.yml b/_config.yml index 8035041..3be0ef3 100644 --- a/_config.yml +++ b/_config.yml @@ -24,12 +24,24 @@ facebook: username : &facebook "site_facebook" app_id : publisher : -disqus_shortname : "mmistakes-dev" # https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname- +comments: + provider : false # false (default), "disqus", "facebook", "google-plus", custom" + disqus: + shortname : "mmistakes-dev" # https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname- + facebook: + # https://developers.facebook.com/docs/plugins/comments + appid : + num_posts : # 5 (default) + width : # 580 (default) + colorscheme : # "light" (default), "dark" google_site_verification : bing_site_verification : alexa_site_verification : yandex_site_verification : -google_analytics : # Universal Analytics tracking ID +analytics: + provider : false # false (default), "google", "google-universal", "custom" + google: + tracking_id : "UA-123456-7" google_ad_client : google_ad_slot : diff --git a/_includes/analytics b/_includes/analytics new file mode 100644 index 0000000..295516a --- /dev/null +++ b/_includes/analytics @@ -0,0 +1,12 @@ +{% if site.analytics.provider and page.analytics != false %} + +{% case site.analytics.provider %} +{% when "google" %} + {% include /analytics-providers/google %} +{% when "google-universal" %} + {% include /analytics-providers/google-universal %} +{% when "custom" %} + {% include /analytics-providers/custom %} +{% endcase %} + +{% endif %} \ No newline at end of file diff --git a/_includes/analytics-providers/custom b/_includes/analytics-providers/custom new file mode 100644 index 0000000..c34b97a --- /dev/null +++ b/_includes/analytics-providers/custom @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/_includes/analytics-providers/google b/_includes/analytics-providers/google new file mode 100644 index 0000000..b591b99 --- /dev/null +++ b/_includes/analytics-providers/google @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/_includes/analytics-providers/google-universal b/_includes/analytics-providers/google-universal new file mode 100644 index 0000000..8da1929 --- /dev/null +++ b/_includes/analytics-providers/google-universal @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/_includes/comments b/_includes/comments new file mode 100644 index 0000000..a549d8e --- /dev/null +++ b/_includes/comments @@ -0,0 +1,14 @@ +{% if site.comments.provider and page.comments %} + +{% case site.comments.provider %} +{% when "disqus" %} + {% include /comments-providers/disqus %} +{% when "facebook" %} + {% include /comments-providers/facebook %} +{% when "google-plus" %} + {% include /comments-providers/google-plus %} +{% when "custom" %} + {% include /comments-providers/custom %} +{% endcase %} + +{% endif %} \ No newline at end of file diff --git a/_includes/comments-providers/custom b/_includes/comments-providers/custom new file mode 100644 index 0000000..9099369 --- /dev/null +++ b/_includes/comments-providers/custom @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/_includes/comments-providers/disqus b/_includes/comments-providers/disqus new file mode 100644 index 0000000..b80be9e --- /dev/null +++ b/_includes/comments-providers/disqus @@ -0,0 +1,22 @@ +{% if site.comments.disqus.shortname %} + + +{% endif %} diff --git a/_includes/comments-providers/facebook b/_includes/comments-providers/facebook new file mode 100644 index 0000000..009dc1c --- /dev/null +++ b/_includes/comments-providers/facebook @@ -0,0 +1,8 @@ +
+ \ No newline at end of file diff --git a/_includes/comments-providers/google-plus b/_includes/comments-providers/google-plus new file mode 100644 index 0000000..cd582c3 --- /dev/null +++ b/_includes/comments-providers/google-plus @@ -0,0 +1,2 @@ + + diff --git a/_includes/disqus-comments b/_includes/disqus-comments deleted file mode 100644 index 721316a..0000000 --- a/_includes/disqus-comments +++ /dev/null @@ -1,22 +0,0 @@ -{% if site.disqus_shortname %} - - -{% endif %} diff --git a/_includes/scripts b/_includes/scripts index c8b4714..dfe7ba4 100644 --- a/_includes/scripts +++ b/_includes/scripts @@ -2,19 +2,5 @@ -{% if site.google_analytics %} - -{% endif %} - -{% if page.comments %} - {% include disqus-comments %} -{% endif %} +{% include analytics %} +{% include comments %} diff --git a/_layouts/single.html b/_layouts/single.html index 5cc99da..3164856 100644 --- a/_layouts/single.html +++ b/_layouts/single.html @@ -32,8 +32,17 @@ layout: default - {% if site.disqus_shortname and page.comments %} -
+ {% if site.comments.provider and page.comments %} + {% case site.comments.provider %} + {% when "disqus" %} +
+ {% when "facebook" %} +
+ {% when "google-plus" %} +
Loading Google+ Comments ...
+ {% when "custom" %} +
+ {% endcase %} {% endif %} -- 2.43.0