better_seo 0.6.0 → 0.8.0
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/CHANGELOG.md +63 -0
- data/README.md +220 -16
- data/lib/better_seo/version.rb +1 -1
- data/lib/better_seo.rb +4 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8e54a1f72d1782db6366637bd76336b7af2bf1d51dd3241dc7ba4be9f0deb75b
|
|
4
|
+
data.tar.gz: a2bc94c2c62edc86b3bf50db8f56424b11649d7aa4d3b53867b55d3561a69a5d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b53dd20aa929536a0de6f293bf2e1efe35437cb9431db5f86f0865bf4bdc8ec3575fd95dbc9843fdb4ebb3c259da65bf9f39ee636c199ec4818141019f71dcbb
|
|
7
|
+
data.tar.gz: 79f5dd0ae283b0a05af28c3f5372db36e9d618fffc4596a5c716b3c67ae4ea5751b2e697dc637837dcb6619d94801be79519364621b339b0df40a3701ed552c5
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,69 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.8.0] - 2025-01-23
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Rails Structured Data View Helpers for easy integration
|
|
14
|
+
- `structured_data_tag(type, **properties, &block)` - Generic helper with type symbol or object
|
|
15
|
+
- `organization_sd(**properties, &block)` - Organization structured data helper
|
|
16
|
+
- `article_sd(**properties, &block)` - Article structured data helper
|
|
17
|
+
- `person_sd(**properties, &block)` - Person structured data helper
|
|
18
|
+
- `product_sd(**properties, &block)` - Product structured data helper
|
|
19
|
+
- `breadcrumb_list_sd(items:, &block)` - Breadcrumb list structured data helper
|
|
20
|
+
- `structured_data_tags(array)` - Multiple structured data tags generation
|
|
21
|
+
- Helper features
|
|
22
|
+
- Support for both hash configuration and block-based DSL
|
|
23
|
+
- Type mapping with symbol-based factory methods
|
|
24
|
+
- Automatic HTML safety with `raw` method
|
|
25
|
+
- Pass existing structured data objects or create on-the-fly
|
|
26
|
+
- Seamless integration with Rails views and layouts
|
|
27
|
+
- Complete Rails integration examples
|
|
28
|
+
- Product page with breadcrumbs and structured data
|
|
29
|
+
- Helper method reference table
|
|
30
|
+
- Type-specific helper examples
|
|
31
|
+
|
|
32
|
+
### Test Coverage
|
|
33
|
+
- 552 tests passing (+22 from v0.7.0)
|
|
34
|
+
- 98.83% code coverage (931/942 lines)
|
|
35
|
+
- 22 new tests for StructuredDataHelper
|
|
36
|
+
|
|
37
|
+
## [0.7.0] - 2025-01-23
|
|
38
|
+
|
|
39
|
+
### Added
|
|
40
|
+
- Additional Structured Data types for e-commerce and navigation
|
|
41
|
+
- `StructuredData::Product` - E-commerce products with comprehensive schema
|
|
42
|
+
- `StructuredData::BreadcrumbList` - Navigation breadcrumbs for site structure
|
|
43
|
+
- Product features
|
|
44
|
+
- Full product information (name, description, image, brand)
|
|
45
|
+
- SKU, GTIN, MPN identifiers support
|
|
46
|
+
- Offers with price, currency, availability (InStock, OutOfStock, PreOrder, etc.)
|
|
47
|
+
- Multiple offers support for variants
|
|
48
|
+
- Aggregate ratings with review count
|
|
49
|
+
- Individual reviews with author and rating
|
|
50
|
+
- Multiple reviews array support
|
|
51
|
+
- Availability URL mapping to Schema.org standards
|
|
52
|
+
- BreadcrumbList features
|
|
53
|
+
- Add single items with `add_item`
|
|
54
|
+
- Add multiple items with `add_items`
|
|
55
|
+
- Automatic position numbering
|
|
56
|
+
- Manual position override support
|
|
57
|
+
- Clear all items with `clear`
|
|
58
|
+
- Fluent method chaining
|
|
59
|
+
- Generates proper ListItem structure
|
|
60
|
+
- Generator helper methods
|
|
61
|
+
- `Generator.product` factory method with block support
|
|
62
|
+
- `Generator.breadcrumb_list` factory method
|
|
63
|
+
- Rails integration examples
|
|
64
|
+
- Product page structured data helpers
|
|
65
|
+
- Breadcrumb integration with Rails routes
|
|
66
|
+
- E-commerce view helpers
|
|
67
|
+
|
|
68
|
+
### Test Coverage
|
|
69
|
+
- 530 tests passing (+39 from v0.6.0)
|
|
70
|
+
- 98.89% code coverage (894/904 lines)
|
|
71
|
+
- 39 new tests for Product and BreadcrumbList
|
|
72
|
+
|
|
10
73
|
## [0.6.0] - 2025-01-23
|
|
11
74
|
|
|
12
75
|
### Added
|
data/README.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
A comprehensive SEO gem for Ruby and Rails applications. BetterSeo provides a clean, fluent DSL for managing meta tags, Open Graph, Twitter Cards, structured data, sitemaps, and more.
|
|
4
4
|
|
|
5
|
-
[](https://github.com/yourusername/better_seo)
|
|
6
|
+
[](https://github.com/yourusername/better_seo)
|
|
7
7
|
[](https://www.ruby-lang.org)
|
|
8
8
|
[](https://rubyonrails.org)
|
|
9
9
|
|
|
10
10
|
## Features
|
|
11
11
|
|
|
12
|
-
### ✅ Implemented (v0.
|
|
12
|
+
### ✅ Implemented (v0.8.0)
|
|
13
13
|
|
|
14
14
|
- **Core Configuration System**
|
|
15
15
|
- Singleton configuration with block-style setup
|
|
@@ -33,7 +33,8 @@ A comprehensive SEO gem for Ruby and Rails applications. BetterSeo provides a cl
|
|
|
33
33
|
- Integration with DSL builders
|
|
34
34
|
|
|
35
35
|
- **Rails Integration**
|
|
36
|
-
- **View Helpers**: `seo_meta_tags`, `seo_open_graph_tags`, `seo_twitter_tags`, `seo_tags`
|
|
36
|
+
- **SEO View Helpers**: `seo_meta_tags`, `seo_open_graph_tags`, `seo_twitter_tags`, `seo_tags`
|
|
37
|
+
- **Structured Data Helpers**: `structured_data_tag`, `organization_sd`, `article_sd`, `person_sd`, `product_sd`, `breadcrumb_list_sd`
|
|
37
38
|
- Support for hash configuration and DSL blocks
|
|
38
39
|
- Automatic HTML safety with `raw` helper
|
|
39
40
|
- Integration with global configuration defaults
|
|
@@ -53,6 +54,8 @@ A comprehensive SEO gem for Ruby and Rails applications. BetterSeo provides a cl
|
|
|
53
54
|
- **Organization**: Company/organization information with address, social profiles
|
|
54
55
|
- **Article**: Blog posts, news articles with author, publisher, metadata
|
|
55
56
|
- **Person**: Author profiles, team members with job title, social links
|
|
57
|
+
- **Product**: E-commerce products with price, availability, ratings, reviews
|
|
58
|
+
- **BreadcrumbList**: Navigation breadcrumbs for improved site structure
|
|
56
59
|
- **Generator Helper**: Factory methods and batch script tag generation
|
|
57
60
|
- **Nested Data**: Automatic handling of complex object relationships
|
|
58
61
|
- **JSON-LD Output**: Valid Schema.org JSON-LD format
|
|
@@ -60,12 +63,12 @@ A comprehensive SEO gem for Ruby and Rails applications. BetterSeo provides a cl
|
|
|
60
63
|
|
|
61
64
|
### 🚧 Planned
|
|
62
65
|
|
|
63
|
-
- **Additional Structured Data Types** (v0.
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
66
|
+
- **Additional Structured Data Types** (v0.8.0)
|
|
67
|
+
- LocalBusiness (physical locations with hours, geo)
|
|
68
|
+
- Event (conferences, webinars with dates, location)
|
|
69
|
+
- FAQPage (structured FAQ with questions/answers)
|
|
70
|
+
- HowTo (step-by-step guides)
|
|
71
|
+
- Recipe (cooking recipes with ingredients)
|
|
69
72
|
|
|
70
73
|
- **Advanced Generators** (v0.7.0)
|
|
71
74
|
- Breadcrumbs HTML generator
|
|
@@ -97,7 +100,7 @@ A comprehensive SEO gem for Ruby and Rails applications. BetterSeo provides a cl
|
|
|
97
100
|
Add this line to your application's Gemfile:
|
|
98
101
|
|
|
99
102
|
```ruby
|
|
100
|
-
gem 'better_seo', '~> 0.
|
|
103
|
+
gem 'better_seo', '~> 0.7.0'
|
|
101
104
|
```
|
|
102
105
|
|
|
103
106
|
And then execute:
|
|
@@ -117,7 +120,7 @@ gem install better_seo
|
|
|
117
120
|
Add this line to your application's Gemfile:
|
|
118
121
|
|
|
119
122
|
```ruby
|
|
120
|
-
gem 'better_seo', git: 'https://github.com/alessiobussolari/better_seo.git', tag: 'v0.
|
|
123
|
+
gem 'better_seo', git: 'https://github.com/alessiobussolari/better_seo.git', tag: 'v0.7.0'
|
|
121
124
|
```
|
|
122
125
|
|
|
123
126
|
Or clone and build locally:
|
|
@@ -126,7 +129,7 @@ Or clone and build locally:
|
|
|
126
129
|
git clone https://github.com/alessiobussolari/better_seo.git
|
|
127
130
|
cd better_seo
|
|
128
131
|
gem build better_seo.gemspec
|
|
129
|
-
gem install better_seo-0.
|
|
132
|
+
gem install better_seo-0.7.0.gem
|
|
130
133
|
```
|
|
131
134
|
|
|
132
135
|
## Quick Start
|
|
@@ -1126,6 +1129,37 @@ person.same_as([
|
|
|
1126
1129
|
])
|
|
1127
1130
|
```
|
|
1128
1131
|
|
|
1132
|
+
**Product** - E-commerce products:
|
|
1133
|
+
|
|
1134
|
+
```ruby
|
|
1135
|
+
product = BetterSeo::StructuredData::Product.new
|
|
1136
|
+
product.name("Premium Wireless Headphones")
|
|
1137
|
+
product.description("High-quality wireless headphones with noise cancellation")
|
|
1138
|
+
product.image("https://example.com/headphones.jpg")
|
|
1139
|
+
product.brand("AudioTech")
|
|
1140
|
+
product.sku("HEADPHONES-WL-NC-2024")
|
|
1141
|
+
product.offers(
|
|
1142
|
+
price: 299.99,
|
|
1143
|
+
price_currency: "USD",
|
|
1144
|
+
availability: "InStock",
|
|
1145
|
+
url: "https://example.com/products/headphones"
|
|
1146
|
+
)
|
|
1147
|
+
product.aggregate_rating(
|
|
1148
|
+
rating_value: 4.7,
|
|
1149
|
+
review_count: 342
|
|
1150
|
+
)
|
|
1151
|
+
```
|
|
1152
|
+
|
|
1153
|
+
**BreadcrumbList** - Navigation breadcrumbs:
|
|
1154
|
+
|
|
1155
|
+
```ruby
|
|
1156
|
+
breadcrumb = BetterSeo::StructuredData::BreadcrumbList.new
|
|
1157
|
+
breadcrumb
|
|
1158
|
+
.add_item(name: "Home", url: "https://example.com")
|
|
1159
|
+
.add_item(name: "Electronics", url: "https://example.com/electronics")
|
|
1160
|
+
.add_item(name: "Headphones", url: "https://example.com/electronics/headphones")
|
|
1161
|
+
```
|
|
1162
|
+
|
|
1129
1163
|
#### Method Chaining
|
|
1130
1164
|
|
|
1131
1165
|
All structured data classes support fluent method chaining:
|
|
@@ -1279,6 +1313,174 @@ And in article views:
|
|
|
1279
1313
|
<%= article_structured_data(@article) %>
|
|
1280
1314
|
```
|
|
1281
1315
|
|
|
1316
|
+
#### Rails View Helpers (v0.8.0)
|
|
1317
|
+
|
|
1318
|
+
BetterSeo includes built-in Rails view helpers for easy structured data integration:
|
|
1319
|
+
|
|
1320
|
+
**Generic Helper - `structured_data_tag`**
|
|
1321
|
+
|
|
1322
|
+
```erb
|
|
1323
|
+
<%# Create from type symbol with hash %>
|
|
1324
|
+
<%= structured_data_tag(:organization,
|
|
1325
|
+
name: "Acme Corp",
|
|
1326
|
+
url: "https://acme.com",
|
|
1327
|
+
logo: "https://acme.com/logo.png"
|
|
1328
|
+
) %>
|
|
1329
|
+
|
|
1330
|
+
<%# Create from type symbol with block %>
|
|
1331
|
+
<%= structured_data_tag(:article) do |article|
|
|
1332
|
+
article.headline("My Article")
|
|
1333
|
+
article.author("John Doe")
|
|
1334
|
+
article.date_published("2024-01-15")
|
|
1335
|
+
end %>
|
|
1336
|
+
|
|
1337
|
+
<%# Pass an existing object %>
|
|
1338
|
+
<% org = BetterSeo::StructuredData::Organization.new(name: "Acme") %>
|
|
1339
|
+
<%= structured_data_tag(org) %>
|
|
1340
|
+
```
|
|
1341
|
+
|
|
1342
|
+
**Type-Specific Helpers**
|
|
1343
|
+
|
|
1344
|
+
Convenience methods for each structured data type:
|
|
1345
|
+
|
|
1346
|
+
```erb
|
|
1347
|
+
<%# Organization %>
|
|
1348
|
+
<%= organization_sd(
|
|
1349
|
+
name: "Acme Corp",
|
|
1350
|
+
url: "https://acme.com"
|
|
1351
|
+
) %>
|
|
1352
|
+
|
|
1353
|
+
<%# Or with block %>
|
|
1354
|
+
<%= organization_sd do |org|
|
|
1355
|
+
org.name("Acme Corp")
|
|
1356
|
+
org.url("https://acme.com")
|
|
1357
|
+
org.logo("https://acme.com/logo.png")
|
|
1358
|
+
end %>
|
|
1359
|
+
|
|
1360
|
+
<%# Article %>
|
|
1361
|
+
<%= article_sd(
|
|
1362
|
+
headline: @article.title,
|
|
1363
|
+
author: @article.author.name,
|
|
1364
|
+
date_published: @article.published_at.iso8601
|
|
1365
|
+
) %>
|
|
1366
|
+
|
|
1367
|
+
<%# Person %>
|
|
1368
|
+
<%= person_sd do |person|
|
|
1369
|
+
person.name("John Doe")
|
|
1370
|
+
person.email("john@example.com")
|
|
1371
|
+
person.job_title("Software Engineer")
|
|
1372
|
+
end %>
|
|
1373
|
+
|
|
1374
|
+
<%# Product %>
|
|
1375
|
+
<%= product_sd do |product|
|
|
1376
|
+
product.name(@product.name)
|
|
1377
|
+
product.brand(@product.brand)
|
|
1378
|
+
product.offers(
|
|
1379
|
+
price: @product.price,
|
|
1380
|
+
price_currency: "USD",
|
|
1381
|
+
availability: "InStock"
|
|
1382
|
+
)
|
|
1383
|
+
product.aggregate_rating(
|
|
1384
|
+
rating_value: @product.average_rating,
|
|
1385
|
+
review_count: @product.reviews_count
|
|
1386
|
+
)
|
|
1387
|
+
end %>
|
|
1388
|
+
|
|
1389
|
+
<%# Breadcrumb List %>
|
|
1390
|
+
<%= breadcrumb_list_sd do |breadcrumb|
|
|
1391
|
+
breadcrumb.add_item(name: "Home", url: root_url)
|
|
1392
|
+
breadcrumb.add_item(name: "Products", url: products_url)
|
|
1393
|
+
breadcrumb.add_item(name: @product.name, url: product_url(@product))
|
|
1394
|
+
end %>
|
|
1395
|
+
|
|
1396
|
+
<%# Or from array %>
|
|
1397
|
+
<% items = [
|
|
1398
|
+
{ name: "Home", url: root_url },
|
|
1399
|
+
{ name: "Products", url: products_url }
|
|
1400
|
+
] %>
|
|
1401
|
+
<%= breadcrumb_list_sd(items: items) %>
|
|
1402
|
+
```
|
|
1403
|
+
|
|
1404
|
+
**Multiple Tags Helper - `structured_data_tags`**
|
|
1405
|
+
|
|
1406
|
+
Generate multiple script tags at once:
|
|
1407
|
+
|
|
1408
|
+
```erb
|
|
1409
|
+
<% org = BetterSeo::StructuredData::Organization.new(name: "Acme") %>
|
|
1410
|
+
<% person = BetterSeo::StructuredData::Person.new(name: "John") %>
|
|
1411
|
+
<% article = BetterSeo::StructuredData::Article.new(headline: "Title") %>
|
|
1412
|
+
|
|
1413
|
+
<%= structured_data_tags([org, person, article]) %>
|
|
1414
|
+
```
|
|
1415
|
+
|
|
1416
|
+
**Complete Rails Example**
|
|
1417
|
+
|
|
1418
|
+
```erb
|
|
1419
|
+
<%# app/views/products/show.html.erb %>
|
|
1420
|
+
<head>
|
|
1421
|
+
<%# Page SEO tags %>
|
|
1422
|
+
<%= seo_tags do |seo|
|
|
1423
|
+
seo.meta do |meta|
|
|
1424
|
+
meta.title @product.name
|
|
1425
|
+
meta.description @product.description
|
|
1426
|
+
end
|
|
1427
|
+
seo.og do |og|
|
|
1428
|
+
og.type "product"
|
|
1429
|
+
og.title @product.name
|
|
1430
|
+
og.image @product.image_url
|
|
1431
|
+
end
|
|
1432
|
+
end %>
|
|
1433
|
+
|
|
1434
|
+
<%# Structured data %>
|
|
1435
|
+
<%= organization_sd do |org|
|
|
1436
|
+
org.name("My Shop")
|
|
1437
|
+
org.url(root_url)
|
|
1438
|
+
end %>
|
|
1439
|
+
|
|
1440
|
+
<%= breadcrumb_list_sd do |bc|
|
|
1441
|
+
bc.add_item(name: "Home", url: root_url)
|
|
1442
|
+
bc.add_item(name: "Products", url: products_url)
|
|
1443
|
+
bc.add_item(name: @product.category, url: category_url(@product.category))
|
|
1444
|
+
bc.add_item(name: @product.name, url: product_url(@product))
|
|
1445
|
+
end %>
|
|
1446
|
+
|
|
1447
|
+
<%= product_sd do |product|
|
|
1448
|
+
product.name(@product.name)
|
|
1449
|
+
product.description(@product.description)
|
|
1450
|
+
product.image(@product.image_url)
|
|
1451
|
+
product.brand(@product.brand)
|
|
1452
|
+
product.sku(@product.sku)
|
|
1453
|
+
product.offers(
|
|
1454
|
+
price: @product.price,
|
|
1455
|
+
price_currency: "USD",
|
|
1456
|
+
availability: @product.in_stock? ? "InStock" : "OutOfStock",
|
|
1457
|
+
url: product_url(@product)
|
|
1458
|
+
)
|
|
1459
|
+
if @product.reviews.any?
|
|
1460
|
+
product.aggregate_rating(
|
|
1461
|
+
rating_value: @product.average_rating,
|
|
1462
|
+
review_count: @product.reviews_count,
|
|
1463
|
+
best_rating: 5
|
|
1464
|
+
)
|
|
1465
|
+
end
|
|
1466
|
+
end %>
|
|
1467
|
+
</head>
|
|
1468
|
+
```
|
|
1469
|
+
|
|
1470
|
+
**Helper Method Reference**
|
|
1471
|
+
|
|
1472
|
+
| Helper | Description |
|
|
1473
|
+
|--------|-------------|
|
|
1474
|
+
| `structured_data_tag(type, **props, &block)` | Generic helper for any type |
|
|
1475
|
+
| `organization_sd(**props, &block)` | Organization structured data |
|
|
1476
|
+
| `article_sd(**props, &block)` | Article structured data |
|
|
1477
|
+
| `person_sd(**props, &block)` | Person structured data |
|
|
1478
|
+
| `product_sd(**props, &block)` | Product structured data |
|
|
1479
|
+
| `breadcrumb_list_sd(items:, &block)` | Breadcrumb list structured data |
|
|
1480
|
+
| `structured_data_tags(array)` | Multiple structured data tags |
|
|
1481
|
+
|
|
1482
|
+
All helpers support both hash configuration and block-based DSL for maximum flexibility.
|
|
1483
|
+
|
|
1282
1484
|
#### Complete Example
|
|
1283
1485
|
|
|
1284
1486
|
```ruby
|
|
@@ -1445,11 +1647,13 @@ bundle exec rspec --format documentation
|
|
|
1445
1647
|
```
|
|
1446
1648
|
|
|
1447
1649
|
Current test statistics:
|
|
1448
|
-
- **
|
|
1449
|
-
- **
|
|
1650
|
+
- **552 tests** passing
|
|
1651
|
+
- **98.83% code coverage** (931/942 lines)
|
|
1450
1652
|
- **3 DSL builders** fully tested
|
|
1451
1653
|
- **3 HTML generators** fully tested
|
|
1452
|
-
- **
|
|
1654
|
+
- **2 Rails view helper modules** fully tested
|
|
1655
|
+
- **5 Structured data types** fully tested
|
|
1656
|
+
- **1 Sitemap generation system** fully tested
|
|
1453
1657
|
- **1 core configuration system** fully tested
|
|
1454
1658
|
|
|
1455
1659
|
## Architecture
|
data/lib/better_seo/version.rb
CHANGED
data/lib/better_seo.rb
CHANGED
|
@@ -13,7 +13,6 @@ require_relative "better_seo/dsl/twitter_cards"
|
|
|
13
13
|
require_relative "better_seo/generators/meta_tags_generator"
|
|
14
14
|
require_relative "better_seo/generators/open_graph_generator"
|
|
15
15
|
require_relative "better_seo/generators/twitter_cards_generator"
|
|
16
|
-
require_relative "better_seo/rails/helpers/seo_helper"
|
|
17
16
|
require_relative "better_seo/sitemap/url_entry"
|
|
18
17
|
require_relative "better_seo/sitemap/builder"
|
|
19
18
|
require_relative "better_seo/sitemap/generator"
|
|
@@ -21,7 +20,11 @@ require_relative "better_seo/structured_data/base"
|
|
|
21
20
|
require_relative "better_seo/structured_data/organization"
|
|
22
21
|
require_relative "better_seo/structured_data/article"
|
|
23
22
|
require_relative "better_seo/structured_data/person"
|
|
23
|
+
require_relative "better_seo/structured_data/product"
|
|
24
|
+
require_relative "better_seo/structured_data/breadcrumb_list"
|
|
24
25
|
require_relative "better_seo/structured_data/generator"
|
|
26
|
+
require_relative "better_seo/rails/helpers/seo_helper"
|
|
27
|
+
require_relative "better_seo/rails/helpers/structured_data_helper"
|
|
25
28
|
|
|
26
29
|
module BetterSeo
|
|
27
30
|
class << self
|