solidus_seo 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -15
- data/app/decorators/controllers/spree/orders_controller_decorator.rb +15 -12
- data/app/views/solidus_seo/_pinterest.html.erb +1 -1
- data/lib/solidus_seo/version.rb +1 -1
- data/spec/examples.txt +30 -30
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d8a42d95a51eeb5b6c4860cda59a6e2bb2c7cb4f575da29ea75b4a1fb729e96
|
4
|
+
data.tar.gz: 22608d6f08eabbfc97b70b9650a96b16c4f79cf1674b3751f3fe650a8d6827c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
63
|
-
- Product
|
64
|
-
- Breadcrumb
|
65
|
-
- ItemList
|
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
|
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 [
|
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.
|
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
|
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
|
-
|
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
|
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
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
|
data/lib/solidus_seo/version.rb
CHANGED
data/spec/examples.txt
CHANGED
@@ -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.
|
4
|
-
./spec/features/checkout_complete_spec.rb[1:1:1] | passed | 0.
|
5
|
-
./spec/features/checkout_complete_spec.rb[1:2:1] | passed |
|
6
|
-
./spec/features/checkout_complete_spec.rb[1:3:1] | passed | 0.
|
7
|
-
./spec/features/checkout_complete_spec.rb[1:4:1] | passed | 0.
|
8
|
-
./spec/features/homepage_spec.rb[1:1:1] | passed |
|
9
|
-
./spec/features/homepage_spec.rb[1:1:2] | passed | 0.
|
10
|
-
./spec/features/homepage_spec.rb[1:2:1] | passed | 0.
|
11
|
-
./spec/features/homepage_spec.rb[1:2:2] | passed | 0.
|
12
|
-
./spec/features/homepage_spec.rb[1:3:1] | passed | 0.
|
13
|
-
./spec/features/homepage_spec.rb[1:3:2] | passed | 0.
|
14
|
-
./spec/features/product_page_spec.rb[1:1:1] | passed | 0.
|
15
|
-
./spec/features/product_page_spec.rb[1:1:2] | passed | 0.
|
16
|
-
./spec/features/product_page_spec.rb[1:1:3] | passed | 0.
|
17
|
-
./spec/features/product_page_spec.rb[1:2:1] | passed | 0.
|
18
|
-
./spec/features/product_page_spec.rb[1:2:2:1] | passed | 0.
|
19
|
-
./spec/features/product_page_spec.rb[1:2:3:1] | passed | 0.
|
20
|
-
./spec/features/product_page_spec.rb[1:3:1] | passed |
|
21
|
-
./spec/features/product_page_spec.rb[1:3:2] | passed | 0.
|
22
|
-
./spec/features/product_page_spec.rb[1:3:3] | passed | 0.
|
23
|
-
./spec/features/product_page_spec.rb[1:4:1:1] | passed | 0.
|
24
|
-
./spec/features/taxon_page_spec.rb[1:1:1] | passed |
|
25
|
-
./spec/features/taxon_page_spec.rb[1:1:2] | passed | 0.
|
26
|
-
./spec/features/taxon_page_spec.rb[1:1:3] | passed | 0.
|
27
|
-
./spec/features/taxon_page_spec.rb[1:2:1] | passed | 0.
|
28
|
-
./spec/features/taxon_page_spec.rb[1:2:2:1] | passed | 0.
|
29
|
-
./spec/features/taxon_page_spec.rb[1:2:3:1] | passed | 0.
|
30
|
-
./spec/features/taxon_page_spec.rb[1:3:1] | passed | 0.
|
31
|
-
./spec/features/taxon_page_spec.rb[1:3:2] | passed | 0.
|
32
|
-
./spec/features/taxon_page_spec.rb[1:4:1] | passed | 0.
|
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.
|
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-
|
11
|
+
date: 2021-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus_core
|