better_seo 0.8.0 → 0.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e54a1f72d1782db6366637bd76336b7af2bf1d51dd3241dc7ba4be9f0deb75b
4
- data.tar.gz: a2bc94c2c62edc86b3bf50db8f56424b11649d7aa4d3b53867b55d3561a69a5d
3
+ metadata.gz: 181be2cb7b7341c4b6d304b2d093351f0259212d880406d1a3673e1ceb4dbd98
4
+ data.tar.gz: 812c35ed74e6250712fa668abbe8274069e601bc5d9bb342283e95061c5f7d83
5
5
  SHA512:
6
- metadata.gz: b53dd20aa929536a0de6f293bf2e1efe35437cb9431db5f86f0865bf4bdc8ec3575fd95dbc9843fdb4ebb3c259da65bf9f39ee636c199ec4818141019f71dcbb
7
- data.tar.gz: 79f5dd0ae283b0a05af28c3f5372db36e9d618fffc4596a5c716b3c67ae4ea5751b2e697dc637837dcb6619d94801be79519364621b339b0df40a3701ed552c5
6
+ metadata.gz: 546233d6a80cc7780d642fd6cf96dcc2ee931dbc39a444a9fc224173579af8a7e8235f9a588a5d212f31c5930c0d6f007fc778090c11baca021ffb690c8b85aa
7
+ data.tar.gz: 4d2620e7b9c8b517d4c412b24b7f7b0b7e3aaf76d4c16f8b9c29357fb9517f1a85225b4130f816902553a0800db0f1aa51999120c07ea6973c138ebfbee7c9a7
data/CHANGELOG.md CHANGED
@@ -7,6 +7,108 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.10.0] - 2025-01-23
11
+
12
+ ### Added
13
+ - Advanced Rails Integration for seamless framework integration
14
+ - **Controller Helpers** (`BetterSeo::Rails::Helpers::ControllerHelpers`)
15
+ - `set_page_title(title, prefix:, suffix:)` - Set page title with optional prefix/suffix
16
+ - `set_page_description(description, max_length:)` - Set description with auto-truncation
17
+ - `set_page_keywords(keywords)` - Set keywords from array or comma-separated string
18
+ - `set_page_image(url, width:, height:)` - Set OG and Twitter image with dimensions
19
+ - `set_canonical(url)` - Set canonical URL
20
+ - `set_noindex(nofollow:)` - Set noindex robot directive
21
+ - `set_meta_tags(data)` - Set custom meta tags (hash or block)
22
+ - `set_og_tags(data)` - Set Open Graph tags (hash or block)
23
+ - `set_twitter_tags(data)` - Set Twitter Card tags (hash or block)
24
+ - `better_seo_data` - Access all stored SEO data
25
+ - **Model Helpers** (`BetterSeo::Rails::ModelHelpers`)
26
+ - `seo_attributes(mappings)` - Class macro for defining SEO attribute mappings
27
+ - Support for symbol, proc, and direct value mappings
28
+ - `seo_title`, `seo_description`, `seo_keywords`, etc. - Auto-generated accessor methods
29
+ - `to_seo_hash` - Convert model to SEO hash for easy controller integration
30
+ - **Railtie** (`BetterSeo::Rails::Railtie`)
31
+ - Automatic helper injection into ActionController
32
+ - Automatic view helper injection into ActionView
33
+ - No manual configuration required
34
+ - **Install Generator** (`rails generate better_seo:install`)
35
+ - Creates `config/initializers/better_seo.rb` with comprehensive defaults
36
+ - Includes examples for all configuration options
37
+ - Shows usage instructions after installation
38
+
39
+ ### Enhanced
40
+ - Controller helpers now available as `helper_method` in views
41
+ - All helpers support both hash and block syntax for flexibility
42
+ - SEO data stored in controller instance variable accessible in views
43
+
44
+ ### Test Coverage
45
+ - 707 tests passing (+38 from v0.9.0)
46
+ - 95.99% code coverage (1293/1347 lines)
47
+ - 38 new tests across Rails integration:
48
+ - ControllerHelpers: 26 tests
49
+ - ModelHelpers: 12 tests
50
+
51
+ ## [0.9.0] - 2025-01-23
52
+
53
+ ### Added
54
+ - Five additional Structured Data types for comprehensive SEO coverage
55
+ - `StructuredData::LocalBusiness` - Physical business locations
56
+ - Complete address with PostalAddress schema
57
+ - Geographic coordinates with GeoCoordinates
58
+ - Opening hours (string and structured specification)
59
+ - Price range and cuisine information
60
+ - Aggregate ratings for customer reviews
61
+ - `StructuredData::Event` - Conferences, webinars, and events
62
+ - Event dates with Date/Time/DateTime support
63
+ - Event status (EventScheduled, EventCancelled, EventPostponed, EventRescheduled)
64
+ - Event attendance mode (Offline, Online, Mixed)
65
+ - Physical and virtual locations with Place/VirtualLocation
66
+ - Organizer (Organization or Person)
67
+ - Multiple ticket offers with pricing and availability
68
+ - Performer support (single or multiple)
69
+ - `StructuredData::FAQPage` - Structured FAQ pages
70
+ - Add single or multiple questions
71
+ - Automatic Question/Answer schema formatting
72
+ - Clear method to reset questions
73
+ - Rich snippets support in search results
74
+ - `StructuredData::HowTo` - Step-by-step guides
75
+ - Named steps with descriptions
76
+ - Automatic position numbering
77
+ - Supply and tool lists
78
+ - Total time estimation
79
+ - Step images and URLs
80
+ - `StructuredData::Recipe` - Cooking recipes
81
+ - Ingredients list management
82
+ - Step-by-step instructions with HowToStep format
83
+ - Prep time, cook time, total time
84
+ - Recipe yield, category, cuisine
85
+ - Nutrition information with NutritionInformation schema
86
+ - Aggregate ratings
87
+ - Keywords support
88
+ - Generator helper methods for all new types
89
+ - `Generator.local_business` with block support
90
+ - `Generator.event` with block support
91
+ - `Generator.faq_page` with block support
92
+ - `Generator.how_to` with block support
93
+ - `Generator.recipe` with block support
94
+ - Rails view helpers for all new types
95
+ - `local_business_sd(**properties, &block)`
96
+ - `event_sd(**properties, &block)`
97
+ - `faq_page_sd(questions:, &block)` - with array support
98
+ - `how_to_sd(steps:, &block)` - with array support
99
+ - `recipe_sd(ingredients:, instructions:, &block)` - with array support
100
+ - Enhanced TYPE_MAPPING in StructuredDataHelper with all 10 types
101
+
102
+ ### Test Coverage
103
+ - 669 tests passing (+117 from v0.8.0)
104
+ - 95.79% code coverage (1205/1258 lines)
105
+ - 117 new tests across 5 structured data types:
106
+ - LocalBusiness: 25 tests
107
+ - Event: 36 tests
108
+ - FAQPage: 11 tests
109
+ - HowTo: 18 tests
110
+ - Recipe: 27 tests
111
+
10
112
  ## [0.8.0] - 2025-01-23
11
113
 
12
114
  ### 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
- [![Tests](https://img.shields.io/badge/tests-552%20passing-brightgreen)](https://github.com/yourusername/better_seo)
6
- [![Coverage](https://img.shields.io/badge/coverage-98.83%25-brightgreen)](https://github.com/yourusername/better_seo)
5
+ [![Tests](https://img.shields.io/badge/tests-707%20passing-brightgreen)](https://github.com/yourusername/better_seo)
6
+ [![Coverage](https://img.shields.io/badge/coverage-95.99%25-brightgreen)](https://github.com/yourusername/better_seo)
7
7
  [![Ruby](https://img.shields.io/badge/ruby-%3E%3D%203.0.0-red)](https://www.ruby-lang.org)
8
8
  [![Rails](https://img.shields.io/badge/rails-%3E%3D%206.1-red)](https://rubyonrails.org)
9
9
 
10
10
  ## Features
11
11
 
12
- ### ✅ Implemented (v0.8.0)
12
+ ### ✅ Implemented (v0.10.0)
13
13
 
14
14
  - **Core Configuration System**
15
15
  - Singleton configuration with block-style setup
@@ -32,9 +32,13 @@ A comprehensive SEO gem for Ruby and Rails applications. BetterSeo provides a cl
32
32
  - HTML entity escaping for security
33
33
  - Integration with DSL builders
34
34
 
35
- - **Rails Integration**
35
+ - **Rails Integration** - Complete framework integration
36
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
+ - **Structured Data Helpers**: `structured_data_tag`, `organization_sd`, `article_sd`, `person_sd`, `product_sd`, `breadcrumb_list_sd`, `local_business_sd`, `event_sd`, `faq_page_sd`, `how_to_sd`, `recipe_sd`
38
+ - **Controller Helpers**: `set_page_title`, `set_page_description`, `set_page_keywords`, `set_page_image`, `set_canonical`, `set_noindex`, `set_meta_tags`, `set_og_tags`, `set_twitter_tags`
39
+ - **Model Helpers**: `seo_attributes` macro for automatic SEO from model attributes
40
+ - **Railtie**: Automatic initialization and helper injection
41
+ - **Generator**: `rails generate better_seo:install` creates initializer
38
42
  - Support for hash configuration and DSL blocks
39
43
  - Automatic HTML safety with `raw` helper
40
44
  - Integration with global configuration defaults
@@ -49,39 +53,31 @@ A comprehensive SEO gem for Ruby and Rails applications. BetterSeo provides a cl
49
53
  - **Validation**: Automatic URL validation (format, protocol)
50
54
  - **Method Chaining**: Fluent interface for adding multiple URLs
51
55
 
52
- - **Structured Data (JSON-LD)**
56
+ - **Structured Data (JSON-LD)** - 10 comprehensive types
53
57
  - **Base Class**: Generic structured data with full Schema.org support
54
58
  - **Organization**: Company/organization information with address, social profiles
55
59
  - **Article**: Blog posts, news articles with author, publisher, metadata
56
60
  - **Person**: Author profiles, team members with job title, social links
57
61
  - **Product**: E-commerce products with price, availability, ratings, reviews
58
62
  - **BreadcrumbList**: Navigation breadcrumbs for improved site structure
59
- - **Generator Helper**: Factory methods and batch script tag generation
63
+ - **LocalBusiness**: Physical locations with address, hours, geo coordinates, ratings
64
+ - **Event**: Conferences, webinars with dates, location, tickets, performers
65
+ - **FAQPage**: Structured FAQ with questions/answers for rich snippets
66
+ - **HowTo**: Step-by-step guides with supplies, tools, and instructions
67
+ - **Recipe**: Cooking recipes with ingredients, nutrition, cooking time
68
+ - **Generator Helper**: Factory methods for all types with block support
60
69
  - **Nested Data**: Automatic handling of complex object relationships
61
70
  - **JSON-LD Output**: Valid Schema.org JSON-LD format
62
- - **Rails Integration**: View helpers and layout integration
71
+ - **Rails Integration**: Complete view helpers for all types
63
72
 
64
73
  ### 🚧 Planned
65
74
 
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)
72
-
73
- - **Advanced Generators** (v0.7.0)
75
+ - **Advanced Generators** (v1.1.0)
74
76
  - Breadcrumbs HTML generator
75
77
  - AMP HTML generator
76
78
  - Canonical URL management
77
79
 
78
- - **Advanced Rails Integration** (v0.7.0)
79
- - Controller helpers for setting page SEO
80
- - Railtie for automatic initialization
81
- - Generator for initializer file
82
- - Automatic meta tags from model attributes
83
-
84
- - **Advanced Sitemap Features** (v0.7.0)
80
+ - **Advanced Sitemap Features** (v1.1.0)
85
81
  - Multi-language sitemap support (hreflang)
86
82
  - Sitemap index for large sites (50,000+ URLs)
87
83
  - Image/video sitemap extensions
@@ -1647,13 +1643,14 @@ bundle exec rspec --format documentation
1647
1643
  ```
1648
1644
 
1649
1645
  Current test statistics:
1650
- - **552 tests** passing
1651
- - **98.83% code coverage** (931/942 lines)
1646
+ - **707 tests** passing
1647
+ - **95.99% code coverage** (1293/1347 lines)
1652
1648
  - **3 DSL builders** fully tested
1653
1649
  - **3 HTML generators** fully tested
1654
- - **2 Rails view helper modules** fully tested
1655
- - **5 Structured data types** fully tested
1650
+ - **3 Rails helper modules** fully tested (View, Controller, Model)
1651
+ - **10 Structured data types** fully tested
1656
1652
  - **1 Sitemap generation system** fully tested
1653
+ - **1 Railtie and Generator** fully tested
1657
1654
  - **1 core configuration system** fully tested
1658
1655
 
1659
1656
  ## Architecture
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BetterSeo
4
- VERSION = "0.8.0"
4
+ VERSION = "0.10.0"
5
5
  end
data/lib/better_seo.rb CHANGED
@@ -22,9 +22,16 @@ require_relative "better_seo/structured_data/article"
22
22
  require_relative "better_seo/structured_data/person"
23
23
  require_relative "better_seo/structured_data/product"
24
24
  require_relative "better_seo/structured_data/breadcrumb_list"
25
+ require_relative "better_seo/structured_data/local_business"
26
+ require_relative "better_seo/structured_data/event"
27
+ require_relative "better_seo/structured_data/faq_page"
28
+ require_relative "better_seo/structured_data/how_to"
29
+ require_relative "better_seo/structured_data/recipe"
25
30
  require_relative "better_seo/structured_data/generator"
26
31
  require_relative "better_seo/rails/helpers/seo_helper"
27
32
  require_relative "better_seo/rails/helpers/structured_data_helper"
33
+ require_relative "better_seo/rails/helpers/controller_helpers"
34
+ require_relative "better_seo/rails/model_helpers"
28
35
 
29
36
  module BetterSeo
30
37
  class << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_seo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - alessiobussolari