scrivito_seo_page_extender 0.0.3 → 0.0.4

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: e36f5aecdce3608188dfc45b51098df74a88c3fd
4
- data.tar.gz: 701c59b234f6da45aa92fe9b7dce823c74e51703
3
+ metadata.gz: 5dae3409cb8920a355f26288a7b1dce5c0fbca54
4
+ data.tar.gz: 59d9a457668d250dcced3a7f254e4b0721696aee
5
5
  SHA512:
6
- metadata.gz: 676fd8b9fbc2e8b828f1ac140e899451a58bb85b640512f4ad7059996ad7d682c4bedf5b2cb7157be6d58995ce843272657c601cb713bb62af4e8cf63c7e2b01
7
- data.tar.gz: 1e61263ca5db92d3f61abcb88565e059504ff1eedabe51e95c809529291bbcf681f3b4dc7342b8b83aacf0f5855a5f122314aefa7ff281fa9255c248860483d1
6
+ metadata.gz: 3c89e6360d02b751789ea613b3b18cd08708087385afb0509cc6b969b18a1de77e5dc0b6ccde80b69b643d98a95328944ce2ee11c309484c06c8ff42ede8604a
7
+ data.tar.gz: 7716db376a99e86cb03abca3291cdd7985a90228f94499e9fd434d7d999422c97929b5677ef323411f32147e8f0b4097adc6b0a8e924c8981c38a1e1e9d02f79
@@ -3,13 +3,14 @@ module MetaDataExtender
3
3
  base.attribute :meta_description, :string
4
4
  base.attribute :meta_keywords, :string
5
5
  base.attribute :meta_author, :string
6
- base.attribute :meta_keywords, :string
7
6
  base.attribute :meta_publisher, :string
8
7
  base.attribute :meta_copyright, :string
9
8
 
9
+ base.attribute :meta_canonical, :string
10
+
10
11
  base.attribute :meta_page_topic, :string
11
12
  base.attribute :meta_page_type, :string
12
- base.attribute :meta_audience, :string
13
- base.attribute :meta_robots, :enum, values: ["index", "noindex", "nofollow", "all"]
13
+ base.attribute :meta_audience, :multienum , values: ["all", "adult", "advanced", "artist", "business", "child", "college", "craft", "elementary", "elhi", "government", "grownup", "health", "high", "institution", "intermediate", "introductory", "law", "lawyer", "listeners", "military", "news", "older", "parent", "patient", "popular", "scholarly", "teacher", "tts", "viewers"]
14
+ base.attribute :meta_robots, :multienum, values: ["noindex", "nofollow", "noarchive", "nosnippet", "noimageindex", "notranslate"]
14
15
  end
15
16
  end
@@ -0,0 +1,44 @@
1
+ module TwitterCardsExtender
2
+ def self.included(base)
3
+ # General Attributes
4
+ base.attribute :tc_card, :enum, values: ["summery", "summary_large_image", "photo", "gallery", "product", "app", "player"]
5
+ base.attribute :tc_creator, :string
6
+ base.attribute :tc_site, :string
7
+ base.attribute :tc_title, :string
8
+ base.attribute :tc_description, :string
9
+
10
+ # Image and Gallery
11
+ base.attribute :tc_image, :reference
12
+ base.attribute :tc_image_width, :string
13
+ base.attribute :tc_image_height, :string
14
+ base.attribute :tc_image1, :reference
15
+ base.attribute :tc_image2, :reference
16
+ base.attribute :tc_image3, :reference
17
+ base.attribute :tc_image4, :reference
18
+
19
+ # For type app
20
+ base.attribute :tc_app_name_iphone, :string
21
+ base.attribute :tc_app_name_ipad, :string
22
+ base.attribute :tc_app_name_googleplay, :string
23
+ base.attribute :tc_app_id_iphone, :string
24
+ base.attribute :tc_app_id_ipad, :string
25
+ base.attribute :tc_app_id_googleplay, :string
26
+ base.attribute :tc_app_url_iphone, :string
27
+ base.attribute :tc_app_url_ipad, :string
28
+ base.attribute :tc_app_url_googleplay, :string
29
+ base.attribute :tc_app_country, :string
30
+
31
+ # For type Player
32
+ base.attribute :tc_player, :string
33
+ base.attribute :tc_player_width, :string
34
+ base.attribute :tc_player_height, :string
35
+ base.attribute :tc_player_stream, :string
36
+ base.attribute :tc_player_stream_content_type, :string
37
+
38
+ # For type Product
39
+ base.attribute :tc_product_data1, :string
40
+ base.attribute :tc_product_label1, :string
41
+ base.attribute :tc_product_data2, :string
42
+ base.attribute :tc_product_label2, :string
43
+ end
44
+ end
@@ -2,7 +2,7 @@ module SeoPageExtenderHelper
2
2
  def words_density(obj, attribute)
3
3
  words = get_words_from_page(obj, attribute).map { |e| e.downcase.gsub(/[^a-z0-9\s]/i, '') }
4
4
  without_stop_words = remove_stop_words(words)
5
- return {
5
+ return {
6
6
  count: without_stop_words.count,
7
7
  density_for_one: density_with_one_word(without_stop_words),
8
8
  density_for_two: density_with_n_word(2,without_stop_words),
@@ -10,6 +10,14 @@ module SeoPageExtenderHelper
10
10
  }
11
11
  end
12
12
 
13
+ def canonical_link(obj)
14
+ if obj.respond_to?(:meta_canonical) && obj.meta_canonical.present?
15
+ obj.meta_canonical
16
+ else
17
+ "https://#{request.raw_host_with_port + scrivito_path(obj)}"
18
+ end
19
+ end
20
+
13
21
  private
14
22
  def get_words_from_page(obj, attribute)
15
23
  strip_tags(scrivito_tag(:span, obj, attribute).to_s).split(" ")
@@ -0,0 +1 @@
1
+ <meta content="<%= canonical_link(@obj) %>" name="canonical"/>
@@ -1,6 +1,8 @@
1
1
  <% if @obj.respond_to?(attribute) && !@obj.send(attribute).blank? %>
2
2
  <% if name.include? 'image' %>
3
3
  <meta content="<%= @obj.send(attribute).try(:binary_url) %>" name="<%= name %>"/>
4
+ <% elsif name == 'audience' || name == 'robots' %>
5
+ <meta content="<%= @obj.send(attribute).join(',') %>" name="<%= name %>"/>
4
6
  <% else %>
5
7
  <meta content="<%= @obj.send(attribute) %>" name="<%= name %>"/>
6
8
  <% end %>
@@ -2,6 +2,8 @@
2
2
  <%= render "seo_page_extender/meta_attribute", attribute: "meta_description", name: "description" %>
3
3
  <%= render "seo_page_extender/meta_attribute", attribute: "meta_robots", name: "robots" %>
4
4
  <%= render "seo_page_extender/meta_attribute", attribute: "meta_author", name: "author" %>
5
-
6
- <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
7
- <meta content="<%= "https://#{request.raw_host_with_port + scrivito_path(@obj)}" %>" name="canonical"/>
5
+ <%= render "seo_page_extender/meta_attribute", attribute: "meta_publisher", name: "publisher" %>
6
+ <%= render "seo_page_extender/meta_attribute", attribute: "meta_page_type", name: "pat_type" %>
7
+ <%= render "seo_page_extender/meta_attribute", attribute: "meta_page_topic", name: "page_topic" %>
8
+ <%= render "seo_page_extender/meta_attribute", attribute: "meta_audience", name: "audience" %>
9
+ <%= render "seo_page_extender/meta_attribute", attribute: "meta_copyright", name: "copyright" %>
@@ -3,13 +3,37 @@
3
3
  <% end %>
4
4
 
5
5
  <%= scrivito_details_for 'Description' do %>
6
- <%= scrivito_tag(:textarea, obj, :meta_description, data: {editor: 'scrivito-textarea-editor'}, style: 'width: 100%; height: 150px' ) %>
6
+ <%= scrivito_tag(:div, obj, :meta_description, data: {editor: 'scrivito-textarea-editor'} ) %>
7
+ <% end %>
8
+
9
+ <%= scrivito_details_for 'Copyright' do %>
10
+ <%= scrivito_tag(:div, obj, :meta_copyright) %>
7
11
  <% end %>
8
12
 
9
13
  <%= scrivito_details_for 'Author' do %>
10
14
  <%= scrivito_tag(:div, obj, :meta_author) %>
11
15
  <% end %>
12
16
 
13
- <%= scrivito_details_for 'Indexing for search engines' do %>
14
- <%= scrivito_toggle_button_editor(obj, :meta_robots) %>
17
+ <%= scrivito_details_for 'Publisher' do %>
18
+ <%= scrivito_tag(:div, obj, :meta_publisher) %>
19
+ <% end %>
20
+
21
+ <%= scrivito_details_for 'Type' do %>
22
+ <%= scrivito_tag(:div, obj, :meta_page_type) %>
23
+ <% end %>
24
+
25
+ <%= scrivito_details_for 'Topic' do %>
26
+ <%= scrivito_tag(:div, obj, :meta_page_topic) %>
27
+ <% end %>
28
+
29
+ <%= scrivito_details_for 'Audience' do %>
30
+ <%= scrivito_multi_select_button_editor(obj, :meta_audience) %>
31
+ <% end %>
32
+
33
+ <%= scrivito_details_for 'Robots' do %>
34
+ <%= scrivito_multi_select_button_editor(obj, :meta_robots) %>
35
+ <% end %>
36
+
37
+ <%= scrivito_details_for 'Canonical Link' do %>
38
+ <%= scrivito_tag(:div, obj, :meta_canonical) %>
15
39
  <% end %>
@@ -0,0 +1,62 @@
1
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_card", name: "tc:card" %>
2
+
3
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_creator", name: "tc:creator" %>
4
+
5
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_site", name: "tc:site" %>
6
+
7
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_title", name: "tc:title" %>
8
+
9
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_description", name: "tc:description" %>
10
+
11
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_image", name: "tc:image" %>
12
+
13
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_image_width", name: "tc:imag:width" %>
14
+
15
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_image_height", name: "tc:imag:height" %>
16
+
17
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_image0", name: "tc:image1" %>
18
+
19
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_image1", name: "tc:image2" %>
20
+
21
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_image2", name: "tc:image3" %>
22
+
23
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_image3", name: "tc:image4" %>
24
+
25
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_app_name_iphone", name: "tc:app:name:iphone" %>
26
+
27
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_app_id_iphone", name: "tc:app:id:iphone" %>
28
+
29
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_app_url_iphone", name: "tc:url:iphone" %>
30
+
31
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_app_name_ipad", name: "tc:name:ipad" %>
32
+
33
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_app_id_ipad", name: "tc:id:ipad" %>
34
+
35
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_app_url_ipad", name: "tc:url:ipad" %>
36
+
37
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_app_name_googleplay", name: "tc:name:googleplay" %>
38
+
39
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_app_id_googleplay", name: "tc:id:googleplay" %>
40
+
41
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_app_url_googleplay", name: "tc:url:googleplay" %>
42
+
43
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_app_country", name: "tc:country" %>
44
+
45
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_player", name: "tc:player" %>
46
+
47
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_player_width", name: "tc:player:width" %>
48
+
49
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_player_height", name: "tc:player:height" %>
50
+
51
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_player_stream", name: "tc:player:stream" %>
52
+
53
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_player_stream_content_type", name: "tc:player:stream:content_type" %>
54
+
55
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_product_data1", name: "tc:data1" %>
56
+
57
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_product_label1", name: "tc:label1" %>
58
+
59
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_product_data2", name: "tc:data2" %>
60
+
61
+ <%= render "seo_page_extender/meta_attribute", attribute: "tc_product_label2", name: "tc:label2" %>
62
+
@@ -0,0 +1,164 @@
1
+ <div class="alert alert-info">
2
+ More informations about twitter cards and the attributes can be <a href="https://dev.twitter.com/cards/getting-started" target="_blank">found here</a>.
3
+ </div>
4
+
5
+ <%= scrivito_details_for 'Card type' do %>
6
+ <%= scrivito_toggle_button_editor(obj, :tc_card) %>
7
+ <% end %>
8
+
9
+ <ul class="tab-list">
10
+ <li class="active" data-panel-target="#edit-twitter-card-general">For All</li>
11
+ <li data-panel-target="#edit-twitter-card-photo">For Photo</li>
12
+ <li data-panel-target="#edit-twitter-card-gallery">For Gallery</li>
13
+ <li data-panel-target="#edit-twitter-card-app">For App</li>
14
+ <li data-panel-target="#edit-twitter-card-product">For Product</li>
15
+ <li data-panel-target="#edit-twitter-card-player">For Player</li>
16
+ </ul>
17
+
18
+ <div class="tab-panels">
19
+ <div class="tab-panel active" id="edit-twitter-card-general">
20
+ <%= scrivito_details_for 'Creator (must start with @)' do %>
21
+ <%= scrivito_tag(:div, obj, :tc_creator) %>
22
+ <% end %>
23
+ <%= scrivito_details_for 'Site' do %>
24
+ <%= scrivito_tag(:div, obj, :tc_site) %>
25
+ <% end %>
26
+
27
+ <%= scrivito_details_for 'Title' do %>
28
+ <%= scrivito_tag(:div, obj, :tc_title) %>
29
+ <% end %>
30
+
31
+ <%= scrivito_details_for 'Description' do %>
32
+ <%= scrivito_tag(:div, obj, :tc_description) %>
33
+ <% end %>
34
+ </div>
35
+
36
+ <div class="tab-panel" id="edit-twitter-card-photo">
37
+ <div class="row">
38
+ <div class="col-xs-4">
39
+ <%= scrivito_details_for 'Image' do %>
40
+ <%= scrivito_tag(:div, obj, :tc_image) %>
41
+ <% end %>
42
+ </div>
43
+ <div class="col-xs-8">
44
+ <%= scrivito_details_for 'Width' do %>
45
+ <%= scrivito_tag(:div, obj, :tc_image_width) %>
46
+ <% end %>
47
+
48
+ <%= scrivito_details_for 'height' do %>
49
+ <%= scrivito_tag(:div, obj, :tc_image_height) %>
50
+ <% end %>
51
+ </div>
52
+ </div>
53
+ </div>
54
+
55
+ <div class="tab-panel" id="edit-twitter-card-gallery">
56
+ <div class="row">
57
+ <div class="col-xs-3">
58
+ <%= scrivito_details_for 'Image 1' do %>
59
+ <%= scrivito_tag(:div, obj, :tc_image1) %>
60
+ <% end %>
61
+ </div>
62
+ <div class="col-xs-3">
63
+ <%= scrivito_details_for 'Image 2' do %>
64
+ <%= scrivito_tag(:div, obj, :tc_image2) %>
65
+ <% end %>
66
+ </div>
67
+ <div class="col-xs-3">
68
+ <%= scrivito_details_for 'Image 3' do %>
69
+ <%= scrivito_tag(:div, obj, :tc_image3) %>
70
+ <% end %>
71
+ </div>
72
+ <div class="col-xs-3">
73
+ <%= scrivito_details_for 'Image 4' do %>
74
+ <%= scrivito_tag(:div, obj, :tc_image4) %>
75
+ <% end %>
76
+ </div>
77
+ </div>
78
+ </div>
79
+
80
+ <div class="tab-panel" id="edit-twitter-card-app">
81
+ <div class="row">
82
+ <div class="col-xs-4">
83
+ <%= scrivito_details_for 'Iphone' do %>
84
+ <h4>App Name</h4>
85
+ <%= scrivito_tag(:div, obj, :tc_app_name_iphone) %>
86
+ <h4>Store ID</h4>
87
+ <%= scrivito_tag(:div, obj, :tc_app_id_iphone) %>
88
+ <h4>Store URL</h4>
89
+ <%= scrivito_tag(:div, obj, :tc_app_url_iphone) %>
90
+ <% end %>
91
+ </div>
92
+ <div class="col-xs-4">
93
+ <%= scrivito_details_for 'Ipad' do %>
94
+ <h4>App Name</h4>
95
+ <%= scrivito_tag(:div, obj, :tc_app_name_ipad) %>
96
+ <h4>Store ID</h4>
97
+ <%= scrivito_tag(:div, obj, :tc_app_id_ipad) %>
98
+ <h4>Store URL</h4>
99
+ <%= scrivito_tag(:div, obj, :tc_app_url_ipad) %>
100
+ <% end %>
101
+ </div>
102
+ <div class="col-xs-4">
103
+ <%= scrivito_details_for 'Googleplay' do %>
104
+ <h4>App Name</h4>
105
+ <%= scrivito_tag(:div, obj, :tc_app_name_googleplay) %>
106
+ <h4>Store ID</h4>
107
+ <%= scrivito_tag(:div, obj, :tc_app_id_googleplay) %>
108
+ <h4>Store URL</h4>
109
+ <%= scrivito_tag(:div, obj, :tc_app_url_googleplay) %>
110
+ <% end %>
111
+ </div>
112
+ </div>
113
+ <%= scrivito_details_for 'Country' do %>
114
+ <%= scrivito_tag(:div, obj, :tc_app_country) %>
115
+ <% end %>
116
+ </div>
117
+
118
+ <div class="tab-panel" id="edit-twitter-card-player">
119
+ <div class="row">
120
+ <div class="col-xs-4">
121
+ <%= scrivito_details_for 'Player' do %>
122
+ <%= scrivito_tag(:div, obj, :tc_player) %>
123
+ <% end %>
124
+ </div>
125
+ <div class="col-xs-4">
126
+ <%= scrivito_details_for 'Dimension' do %>
127
+ <h4>Width</h4>
128
+ <%= scrivito_tag(:div, obj, :tc_width) %>
129
+ <h4>Height</h4>
130
+ <%= scrivito_tag(:div, obj, :tc_height) %>
131
+ <% end %>
132
+ </div>
133
+ <div class="col-xs-4">
134
+ <%= scrivito_details_for do %>
135
+ <h4>Stream</h4>
136
+ <%= scrivito_tag(:div, obj, :tc_player_stream) %>
137
+ <h4>Content Type</h4>
138
+ <%= scrivito_tag(:div, obj, :tc_player_stream_content_type) %>
139
+ <% end %>
140
+ </div>
141
+ </div>
142
+ </div>
143
+
144
+ <div class="tab-panel" id="edit-twitter-card-product">
145
+ <div class="row">
146
+ <div class="col-xs-6">
147
+ <%= scrivito_details_for 'Top Data' do %>
148
+ <h4>Top customizable data field</h4>
149
+ <%= scrivito_tag(:div, obj, :tc_product_data1) %>
150
+ <h4>Customizable label or units</h4>
151
+ <%= scrivito_tag(:div, obj, :tc_product_label1) %>
152
+ <% end %>
153
+ </div>
154
+ <div class="col-xs-6">
155
+ <%= scrivito_details_for 'Bottom Data' do %>
156
+ <h4>Bottom customizable data field</h4>
157
+ <%= scrivito_tag(:div, obj, :tc_product_data2) %>
158
+ <h4>Customizable label or units</h4>
159
+ <%= scrivito_tag(:div, obj, :tc_product_label2) %>
160
+ <% end %>
161
+ </div>
162
+ </div>
163
+ </div>
164
+ </div>
@@ -1,3 +1,3 @@
1
1
  module ScrivitoSeoPageExtender
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivito_seo_page_extender
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scrivito
@@ -81,7 +81,9 @@ files:
81
81
  - app/concerns/meta_data_extender.rb
82
82
  - app/concerns/open_graph_extender.rb
83
83
  - app/concerns/sitemap_extender.rb
84
+ - app/concerns/twitter_cards_extender.rb
84
85
  - app/helper/seo_page_extender_helper.rb
86
+ - app/views/seo_page_extender/_canonical_link.html.erb
85
87
  - app/views/seo_page_extender/_edit_permalink.html.erb
86
88
  - app/views/seo_page_extender/_google_analytics.html.erb
87
89
  - app/views/seo_page_extender/_meta_attribute.html.erb
@@ -90,6 +92,8 @@ files:
90
92
  - app/views/seo_page_extender/_open_graph.html.erb
91
93
  - app/views/seo_page_extender/_open_graph_details.html.erb
92
94
  - app/views/seo_page_extender/_sitemap_details.html.erb
95
+ - app/views/seo_page_extender/_twitter_cards.html.erb
96
+ - app/views/seo_page_extender/_twitter_cards_details.html.erb
93
97
  - app/views/seo_page_extender/_word_density.html.erb
94
98
  - app/views/seo_page_extender/_word_density_part.html.erb
95
99
  - lib/scrivito_seo_page_extender.rb