solidus_seo 1.0.8 → 1.0.10

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
  SHA256:
3
- metadata.gz: 3626084993746b4fd03d1ac122e5e5fd15e2c425e24c09ff66e48c85a8f58fd8
4
- data.tar.gz: dc2e82b2dae8291d44ef540c3085b5ccc85682819acb3c405308e33e879f987b
3
+ metadata.gz: 6d8a42d95a51eeb5b6c4860cda59a6e2bb2c7cb4f575da29ea75b4a1fb729e96
4
+ data.tar.gz: 22608d6f08eabbfc97b70b9650a96b16c4f79cf1674b3751f3fe650a8d6827c5
5
5
  SHA512:
6
- metadata.gz: 5523b7a476f2e1f0fb42ea23ca16c926ecbff1f6c32f65438d431bfcb55c4ad84bdb3a4599356235f949b1c7dbafdfb1289d7edd98222851bd2d9d8aa6309471
7
- data.tar.gz: 8b63780e4f7d9619c0c48dfda3f026a39e0b193fcda651df108d3ef5f60cbcc873d21155f1355ead1eeb8d60ec5249c536b469ec88ee69c51835e67a1183ad62
6
+ metadata.gz: ab4aa4274b86aca434eb398bf144eef576632bdf7c5afabe777abfc6091d852b04cef095fc9d6992d71e815043f4fa52e23de8bdff9bc79bd0fb62512f395c26
7
+ data.tar.gz: 6ee6fadcea36ed37c9f821310566c5e8f92e25401098b2390c3a3a8eb290042550f683098d020be587f0ef21f187fc8837904b54b5ec063a98aee28af17db601
data/README.md CHANGED
@@ -43,26 +43,24 @@ Here are the changes we make, via deface, in the default Solidus views as part o
43
43
  - Replace the `<%== meta_data_tags %>` line for `<%= display_meta_tags %>`.
44
44
  - Remove the `<title>` tag (`display_meta_tags` generates a new title tag).
45
45
 
46
-
47
46
  - In `spree/layouts/spree_application.html.erb`
48
47
  - Insert `<%= render 'solidus_seo/analytics' %>` just before `</head>`.
49
48
  - Insert `<%= dump_jsonld %>` just before the `</body>` closing tag.
50
-
49
+ - Replace `<%= taxon_breadcrumbs(@taxon) %>` with (`<%= taxon_breadcrumbs_jsonld(@taxon) %>`) which does the same as the original plus prints a JSON-LD tag.
51
50
 
52
51
  - In `spree/products/show.html.erb`:
53
52
  - Insert `<%= jsonld @product %>` anywhere inside the `cache` block.
54
53
 
55
-
56
54
  - In `spree/shared/_products.html.erb`:
57
- - Insert `<% jsonld_list(products) %>` at the bottom of the file. (Notice this helper doesn't generate any output, as instead it simply adds to the data that's later outputted by dump_jsonld)
55
+ - Insert `<% jsonld_list(products) %>` at the bottom of the file. (Notice this helper doesn't generate any output, as instead it simply adds to the data that's later outputted by `dump_jsonld`)
58
56
 
59
57
  At this point, assuming you're using the default Solidus views and this extension's deface overrides, the features you've gained are:
60
58
 
61
59
  - Default meta tags including open graph tags, describing a product on the PDP pages, and describing the store/site in all other pages.
62
- - Store jsonld markup on all your pages.
63
- - Product jsonld markup in your PDP pages.
64
- - Breadcrumb jsonld markup in your taxon pages.
65
- - ItemList jsonld markup in your paginated product pages.
60
+ - Store JSON-LD markup on all your pages.
61
+ - Product JSON-LD markup in your PDP pages.
62
+ - Breadcrumb JSON-LD markup in your taxon pages.
63
+ - ItemList JSON-LD markup in your paginated product pages.
66
64
  - Site-wide default paperclip image optimization (through image_optim)
67
65
  - Page view and eCommerce conversion tracking (completed checkouts) enabled via presence of `GOOGLE_TAG_MANAGER_ID`, `GOOGLE_ANALYTICS_ID`, `FACEBOOK_PIXEL_ID`, `PINTEREST_TAG_ID` environment variables (only one Google integration should be enabled at a time).
68
66
 
@@ -70,7 +68,7 @@ At this point, assuming you're using the default Solidus views and this extensio
70
68
 
71
69
  This gem is intended to provide a progressive implementation approach. To begin with, it defines some methods in your models to be used as an interface/source of your meta data. Moreover, it already provides some useful defaults that can be easily extended and customized, all inside your Spree models, via decorators.
72
70
 
73
- Practically speaking, what this means is that simply by setting your store's metadata from the admin and calling the display_meta_tags helper in your layout, you'll get basic jsonld data included for your store. The output would be similar to the following:
71
+ Practically speaking, what this means is that simply by setting your store's metadata from the admin and calling the display_meta_tags helper in your layout, you'll get basic JSON-LD data included for your store. The output would be similar to the following:
74
72
 
75
73
  ```json
76
74
  {
@@ -114,9 +112,9 @@ The basic requirements for the return values of your methods are straight-forwar
114
112
 
115
113
  and
116
114
 
117
- - `jsonld_data` must return a hash, holding a [jsonld definition](https://en.wikipedia.org/wiki/JSON-LD).
115
+ - `jsonld_data` must return a hash, holding a [JSON-LD definition](https://en.wikipedia.org/wiki/JSON-LD).
118
116
 
119
- For the purpose of illustration, a simple example could be adding a new file to your Solidus app, `app/models/spree/order_decorator.rb`, to implement the jsonld_data interface for `Spree::Order`; the override for the seo_data interface would be placed and implemented similarly. [NOTE: To be clear, this extension provides no default implementation for `Spree::Order.jsonld_data` - the code below is meant solely as an example override for those new to Solidus and who, accordingly, might be unfamiliar with its override mechanics (decorators).]
117
+ For the purpose of illustration, a simple example could be adding a new file to your Solidus app, `app/models/spree/order_decorator.rb`, to implement the `jsonld_data` interface for `Spree::Order`; the override for the seo_data interface would be placed and implemented similarly. NOTE: To be clear, this extension provides no default implementation for `Spree::Order.jsonld_data` - the code below is meant solely as an example override for those new to Solidus and who, accordingly, might be unfamiliar with its override mechanics (decorators).
120
118
 
121
119
  ```ruby
122
120
  # app/models/spree/order_decorator.rb
@@ -152,19 +150,19 @@ Spree::Order.class_eval do
152
150
  end
153
151
  ```
154
152
 
155
- After adding the new decorator, all that's left would be adding a call to jsonld on the object within your view, such as:
153
+ After adding the new decorator, all that's left would be adding a call to `jsonld` helper on the object, such as:
156
154
 
157
155
  ```erb
158
156
  <%= jsonld(@order) %>
159
157
  ```
160
158
 
161
- [In short, `jsonld` is a helper that parses any object that implements the `to_jsonld` method (added by `SolidusSeo::Model` module), which in turn makes use of the `jsonld_data` method, and returns a script tag.]
159
+ In short, `jsonld` parses any object that implements the `to_jsonld` method (added by `SolidusSeo::Model` module), which in turn makes use of the `jsonld_data` method, and returns a script tag.
162
160
 
163
- Besides these base methods, there are some model-specific ones for Spree::Store and Spree::Product which are explained in the following sections. These are intended to provide you with some additional common and useful data.
161
+ Besides these base methods, there are some model-specific ones for `Spree::Store` and `Spree::Product` which are explained in the following sections. These are intended to provide you with some additional common and useful data.
164
162
 
165
163
  #### Spree::Store
166
164
 
167
- Again, even without any additional work beyond the initial installation, you get a solid/basic jsonld definition for your Spree::Store model. By default:
165
+ Again, even without any additional work beyond the initial installation, you get a solid/basic JSON-LD definition for your `Spree::Store` model. By default:
168
166
 
169
167
  ```json
170
168
  {
@@ -24,23 +24,26 @@ module Spree
24
24
  end.to_h.compact
25
25
 
26
26
  cart_diff = cart_diff.map do |variant_sku, quantity|
27
- variant = Spree::Variant.find_by(sku: variant_sku)
28
-
29
- [
30
- variant_sku,
31
- {
32
- id: variant.product.master.sku,
33
- name: variant.product.name,
34
- variant: variant.options_text,
35
- price: variant.price,
36
- quantity: quantity
37
- }
38
- ]
27
+ variant_hash = cart_diff_variant_payload(variant_sku)
28
+ variant_hash[:quantity] = quantity
29
+
30
+ [variant_sku, variant_hash]
39
31
  end.to_h
40
32
 
41
33
  flash[:added_to_cart] = cart_diff if cart_diff.present?
42
34
  end
43
35
 
36
+ def cart_diff_variant_payload(sku)
37
+ variant = Spree::Variant.find_by(sku: sku)
38
+
39
+ {
40
+ id: variant.product.master.sku,
41
+ name: variant.product.name,
42
+ variant: variant.options_text,
43
+ price: variant.price
44
+ }
45
+ end
46
+
44
47
  def order_contents_hash
45
48
  return {} if current_order.blank?
46
49
 
@@ -6,7 +6,7 @@ add_to_cart_data = {}
6
6
  order_data = {}
7
7
  em_data = {}
8
8
 
9
- user_email = current_order&.email || try_spree_current_user&.email
9
+ user_email = try_spree_current_user&.email || current_order&.email
10
10
  if user_email.present?
11
11
  em_data = { em: user_email }
12
12
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusSeo
4
- VERSION = '1.0.8'
4
+ VERSION = '1.0.10'
5
5
  end
@@ -1,32 +1,32 @@
1
1
  example_id | status | run_time |
2
2
  ------------------------------------------------ | ------ | --------------- |
3
- ./spec/features/add_to_cart_spec.rb[1:1:1] | passed | 1.6 seconds |
4
- ./spec/features/checkout_complete_spec.rb[1:1:1] | passed | 0.65012 seconds |
5
- ./spec/features/checkout_complete_spec.rb[1:2:1] | passed | 0.56665 seconds |
6
- ./spec/features/checkout_complete_spec.rb[1:3:1] | passed | 0.66929 seconds |
7
- ./spec/features/checkout_complete_spec.rb[1:4:1] | passed | 0.44838 seconds |
8
- ./spec/features/homepage_spec.rb[1:1:1] | passed | 2.3 seconds |
9
- ./spec/features/homepage_spec.rb[1:1:2] | passed | 0.22388 seconds |
10
- ./spec/features/homepage_spec.rb[1:2:1] | passed | 0.2209 seconds |
11
- ./spec/features/homepage_spec.rb[1:2:2] | passed | 0.18137 seconds |
12
- ./spec/features/homepage_spec.rb[1:3:1] | passed | 0.20727 seconds |
13
- ./spec/features/homepage_spec.rb[1:3:2] | passed | 0.20346 seconds |
14
- ./spec/features/product_page_spec.rb[1:1:1] | passed | 0.29118 seconds |
15
- ./spec/features/product_page_spec.rb[1:1:2] | passed | 0.30857 seconds |
16
- ./spec/features/product_page_spec.rb[1:1:3] | passed | 0.28452 seconds |
17
- ./spec/features/product_page_spec.rb[1:2:1] | passed | 0.47017 seconds |
18
- ./spec/features/product_page_spec.rb[1:2:2:1] | passed | 0.3369 seconds |
19
- ./spec/features/product_page_spec.rb[1:2:3:1] | passed | 0.37361 seconds |
20
- ./spec/features/product_page_spec.rb[1:3:1] | passed | 0.33857 seconds |
21
- ./spec/features/product_page_spec.rb[1:3:2] | passed | 0.29488 seconds |
22
- ./spec/features/product_page_spec.rb[1:3:3] | passed | 0.26324 seconds |
23
- ./spec/features/product_page_spec.rb[1:4:1:1] | passed | 0.4502 seconds |
24
- ./spec/features/taxon_page_spec.rb[1:1:1] | passed | 1.04 seconds |
25
- ./spec/features/taxon_page_spec.rb[1:1:2] | passed | 0.31403 seconds |
26
- ./spec/features/taxon_page_spec.rb[1:1:3] | passed | 0.30921 seconds |
27
- ./spec/features/taxon_page_spec.rb[1:2:1] | passed | 0.32058 seconds |
28
- ./spec/features/taxon_page_spec.rb[1:2:2:1] | passed | 0.30031 seconds |
29
- ./spec/features/taxon_page_spec.rb[1:2:3:1] | passed | 0.31003 seconds |
30
- ./spec/features/taxon_page_spec.rb[1:3:1] | passed | 0.30324 seconds |
31
- ./spec/features/taxon_page_spec.rb[1:3:2] | passed | 0.3043 seconds |
32
- ./spec/features/taxon_page_spec.rb[1:4:1] | passed | 0.5174 seconds |
3
+ ./spec/features/add_to_cart_spec.rb[1:1:1] | passed | 1.83 seconds |
4
+ ./spec/features/checkout_complete_spec.rb[1:1:1] | passed | 0.5577 seconds |
5
+ ./spec/features/checkout_complete_spec.rb[1:2:1] | passed | 4.04 seconds |
6
+ ./spec/features/checkout_complete_spec.rb[1:3:1] | passed | 0.80112 seconds |
7
+ ./spec/features/checkout_complete_spec.rb[1:4:1] | passed | 0.61828 seconds |
8
+ ./spec/features/homepage_spec.rb[1:1:1] | passed | 0.25538 seconds |
9
+ ./spec/features/homepage_spec.rb[1:1:2] | passed | 0.29293 seconds |
10
+ ./spec/features/homepage_spec.rb[1:2:1] | passed | 0.22449 seconds |
11
+ ./spec/features/homepage_spec.rb[1:2:2] | passed | 0.32462 seconds |
12
+ ./spec/features/homepage_spec.rb[1:3:1] | passed | 0.21716 seconds |
13
+ ./spec/features/homepage_spec.rb[1:3:2] | passed | 0.19521 seconds |
14
+ ./spec/features/product_page_spec.rb[1:1:1] | passed | 0.357 seconds |
15
+ ./spec/features/product_page_spec.rb[1:1:2] | passed | 0.3146 seconds |
16
+ ./spec/features/product_page_spec.rb[1:1:3] | passed | 0.30766 seconds |
17
+ ./spec/features/product_page_spec.rb[1:2:1] | passed | 0.42866 seconds |
18
+ ./spec/features/product_page_spec.rb[1:2:2:1] | passed | 0.32146 seconds |
19
+ ./spec/features/product_page_spec.rb[1:2:3:1] | passed | 0.34169 seconds |
20
+ ./spec/features/product_page_spec.rb[1:3:1] | passed | 3.69 seconds |
21
+ ./spec/features/product_page_spec.rb[1:3:2] | passed | 0.33422 seconds |
22
+ ./spec/features/product_page_spec.rb[1:3:3] | passed | 0.35778 seconds |
23
+ ./spec/features/product_page_spec.rb[1:4:1:1] | passed | 0.83177 seconds |
24
+ ./spec/features/taxon_page_spec.rb[1:1:1] | passed | 0.37527 seconds |
25
+ ./spec/features/taxon_page_spec.rb[1:1:2] | passed | 0.34972 seconds |
26
+ ./spec/features/taxon_page_spec.rb[1:1:3] | passed | 0.34283 seconds |
27
+ ./spec/features/taxon_page_spec.rb[1:2:1] | passed | 0.43213 seconds |
28
+ ./spec/features/taxon_page_spec.rb[1:2:2:1] | passed | 0.48963 seconds |
29
+ ./spec/features/taxon_page_spec.rb[1:2:3:1] | passed | 0.3796 seconds |
30
+ ./spec/features/taxon_page_spec.rb[1:3:1] | passed | 0.44923 seconds |
31
+ ./spec/features/taxon_page_spec.rb[1:3:2] | passed | 0.35334 seconds |
32
+ ./spec/features/taxon_page_spec.rb[1:4:1] | passed | 0.62911 seconds |
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_seo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karma Creative
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-19 00:00:00.000000000 Z
11
+ date: 2021-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core