middleman-social_tag_view_helper 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e42c344fbf48cb8971ee93fdd285886090cc2f7
|
4
|
+
data.tar.gz: 4ad70678a4735e28b19a18ef78cb9dfbf89e8f69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 157722963248876f6165461dacd904584a1f52d8c446669e2926a346451c245e8c0adbaa65eb7ef12de754e3f3e3c612bbba7adcb16eb03ee8171cb9da4faebe
|
7
|
+
data.tar.gz: 3bcfd1acaf7827c780368692bb99d80e25150e6d9ceb086b1e05ddab24f66db6301040e4b1bc88e6123548059d033ae3e44d1a25c03231cdadf53670f65771cb
|
@@ -1,13 +1,21 @@
|
|
1
1
|
module Middleman
|
2
2
|
module SocialTagViewHelper
|
3
3
|
module Helper
|
4
|
+
def current_url
|
5
|
+
current_path.sub(/index\.html/, "")
|
6
|
+
end
|
7
|
+
|
8
|
+
def top_page?
|
9
|
+
current_path == ''
|
10
|
+
end
|
11
|
+
|
4
12
|
def open_graph_meta_tag(page_type: "website", page_title: nil, page_image: nil, _site_url: nil, _site_title: nil, _site_description: nil)
|
5
13
|
_site_url ||= site_url
|
6
14
|
_site_title ||= site_title
|
7
15
|
_site_description ||= site_description
|
8
|
-
|
16
|
+
unless top_page?
|
9
17
|
page_type = "article"
|
10
|
-
_site_url += "/#{
|
18
|
+
_site_url += "/#{current_url}"
|
11
19
|
end
|
12
20
|
%Q|<meta property="og:type" content="#{page_type}">
|
13
21
|
<meta property="og:url" content="#{_site_url}">
|
@@ -19,7 +27,7 @@ module Middleman
|
|
19
27
|
|
20
28
|
def hatena_bookmark_button(_site_url = nil, _site_title = nil)
|
21
29
|
_site_url ||= site_url
|
22
|
-
_site_url += "/#{
|
30
|
+
_site_url += "/#{current_url}" unless top_page?
|
23
31
|
_site_title ||= site_title
|
24
32
|
%Q|<a href="http://b.hatena.ne.jp/entry/#{_site_url.sub(/^http[s]?:\/\//, '')}" class="hatena-bookmark-button" data-hatena-bookmark-title="#{_site_title}" data-hatena-bookmark-layout="standard-balloon" data-hatena-bookmark-lang="ja" title="このエントリーをはてなブックマークに追加">
|
25
33
|
<img src="https://b.st-hatena.com/images/entry-button/button-only@2x.png" alt="このエントリーをはてなブックマークに追加" width="20" height="20" style="border: none;" />
|
@@ -59,10 +67,10 @@ module Middleman
|
|
59
67
|
output = facebook_sdk(_facebook_app_id) unless @facebook_sdk_already_use
|
60
68
|
|
61
69
|
_site_url = site_url
|
62
|
-
_site_url += "/#{
|
70
|
+
_site_url += "/#{current_url}" unless top_page?
|
63
71
|
output += %Q|<div
|
64
72
|
class="fb-share-button"
|
65
|
-
data-href="#{site_url}
|
73
|
+
data-href="#{site_url}"
|
66
74
|
data-layout="button_count">
|
67
75
|
</div>|
|
68
76
|
output
|
@@ -75,7 +83,7 @@ module Middleman
|
|
75
83
|
else
|
76
84
|
nil
|
77
85
|
end
|
78
|
-
%Q
|
86
|
+
%Q*<a href="https://twitter.com/share" class="twitter-share-button"{count}#{account}>Tweet</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>*
|
79
87
|
end
|
80
88
|
|
81
89
|
def facebook_comment(_facebook_app_id: nil, _comment_count: nil)
|
@@ -83,7 +91,7 @@ module Middleman
|
|
83
91
|
output = facebook_sdk(_facebook_app_id) unless @facebook_sdk_already_use
|
84
92
|
|
85
93
|
_site_url = site_url
|
86
|
-
_site_url += "/#{
|
94
|
+
_site_url += "/#{current_url}" unless top_page?
|
87
95
|
_comment_count ||= facebook_comment_count if self.try(:facebook_comment_count)
|
88
96
|
_comment_count ||= 5
|
89
97
|
%Q|<div class="fb-comments" data-href="#{_site_url}" data-numposts="#{_comment_count}"></div>|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-social_tag_view_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takumi Onodera
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman-core
|