better_seo 0.9.0 → 0.11.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: 02c10b033ffd80fd718852f24434af741e4804e8353b792dfa37bdb70ea1583c
4
- data.tar.gz: cec2c0bd8391ec44eeffeedaf9f64c35c2070e575f9addb999e4f04034da561e
3
+ metadata.gz: 1c99ac27d15378d081160acc05a0cfa384a32f732deb452e3ba404d13b040ca7
4
+ data.tar.gz: a7f07d8267cdc57c2a09f86e7c26167fc7c1f23c3ef73df944aa6bc6bc8a87e0
5
5
  SHA512:
6
- metadata.gz: d03af8f52407d32434526df94a5b871dc797a28cb6352d52acf850b5b4626b30db22bb35641858801f7d25ae07614ac94913718558c1486d89a69caecc295966
7
- data.tar.gz: 003afa3422b02cfb5f043b92799b67ab099304f95fe99e80469226dae9c67dfcfb1f1835692462a203b4c3b8fbf4db5ed092866c333d7ddf8abaaf2247e6b644
6
+ metadata.gz: 413a2b9f1342f61fe4b5f26f22a6f9d3152f775699bdc51f105aa77e5740ac78030da6ae06ba6397b2372fb996e8d343a52469a972bb6996d67f9358c4ca7dfc
7
+ data.tar.gz: 1bf40ac3c4e21559eda6cb663f44c8aaef5b2ed8c58e43a06b44028df9f1833d908eb0c44159ec12c467c7b3c6ea7001b2ebc188ba27a06de81d95c34e06bbef
data/CHANGELOG.md CHANGED
@@ -7,6 +7,88 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.11.0] - 2025-01-23
11
+
12
+ ### Added
13
+ - Advanced Sitemap Features for large and international sites
14
+ - **Multi-language Support (hreflang)**
15
+ - `UrlEntry#add_alternate(href, hreflang:)` - Add alternate language versions
16
+ - Support for region-specific alternates (en-US, en-GB, etc.)
17
+ - x-default alternate support for default language
18
+ - Automatic xhtml:link tag generation in XML
19
+ - Method chaining for adding multiple alternates
20
+ - **Image Sitemap Extensions**
21
+ - `UrlEntry#add_image(loc, title:, caption:)` - Add images to URLs
22
+ - Support for multiple images per URL
23
+ - Automatic image:image tag generation
24
+ - Optional title and caption metadata
25
+ - **Video Sitemap Extensions**
26
+ - `UrlEntry#add_video(thumbnail_loc:, title:, description:, content_loc:, duration:)` - Add videos to URLs
27
+ - Support for multiple videos per URL
28
+ - Automatic video:video tag generation
29
+ - Optional duration metadata
30
+ - **Sitemap Index** (`BetterSeo::Sitemap::SitemapIndex`)
31
+ - Manage large sites with 50,000+ URLs
32
+ - Split sitemaps across multiple files
33
+ - `add_sitemap(loc, lastmod:)` - Add sitemaps to index
34
+ - `to_xml` - Generate sitemapindex XML
35
+ - `write_to_file(path)` - Write index to file
36
+ - Automatic directory creation
37
+
38
+ ### Enhanced
39
+ - `UrlEntry` now supports alternates, images, and videos arrays
40
+ - `UrlEntry#to_xml` includes all extensions (hreflang, images, videos)
41
+ - `UrlEntry#to_h` includes alternates when present
42
+
43
+ ### Test Coverage
44
+ - 742 tests passing (+35 from v0.10.0)
45
+ - 96.12% code coverage (1364/1419 lines)
46
+ - 35 new tests across advanced sitemap features:
47
+ - Hreflang support: 11 tests
48
+ - SitemapIndex: 12 tests
49
+ - Image/Video extensions: 12 tests
50
+
51
+ ## [0.10.0] - 2025-01-23
52
+
53
+ ### Added
54
+ - Advanced Rails Integration for seamless framework integration
55
+ - **Controller Helpers** (`BetterSeo::Rails::Helpers::ControllerHelpers`)
56
+ - `set_page_title(title, prefix:, suffix:)` - Set page title with optional prefix/suffix
57
+ - `set_page_description(description, max_length:)` - Set description with auto-truncation
58
+ - `set_page_keywords(keywords)` - Set keywords from array or comma-separated string
59
+ - `set_page_image(url, width:, height:)` - Set OG and Twitter image with dimensions
60
+ - `set_canonical(url)` - Set canonical URL
61
+ - `set_noindex(nofollow:)` - Set noindex robot directive
62
+ - `set_meta_tags(data)` - Set custom meta tags (hash or block)
63
+ - `set_og_tags(data)` - Set Open Graph tags (hash or block)
64
+ - `set_twitter_tags(data)` - Set Twitter Card tags (hash or block)
65
+ - `better_seo_data` - Access all stored SEO data
66
+ - **Model Helpers** (`BetterSeo::Rails::ModelHelpers`)
67
+ - `seo_attributes(mappings)` - Class macro for defining SEO attribute mappings
68
+ - Support for symbol, proc, and direct value mappings
69
+ - `seo_title`, `seo_description`, `seo_keywords`, etc. - Auto-generated accessor methods
70
+ - `to_seo_hash` - Convert model to SEO hash for easy controller integration
71
+ - **Railtie** (`BetterSeo::Rails::Railtie`)
72
+ - Automatic helper injection into ActionController
73
+ - Automatic view helper injection into ActionView
74
+ - No manual configuration required
75
+ - **Install Generator** (`rails generate better_seo:install`)
76
+ - Creates `config/initializers/better_seo.rb` with comprehensive defaults
77
+ - Includes examples for all configuration options
78
+ - Shows usage instructions after installation
79
+
80
+ ### Enhanced
81
+ - Controller helpers now available as `helper_method` in views
82
+ - All helpers support both hash and block syntax for flexibility
83
+ - SEO data stored in controller instance variable accessible in views
84
+
85
+ ### Test Coverage
86
+ - 707 tests passing (+38 from v0.9.0)
87
+ - 95.99% code coverage (1293/1347 lines)
88
+ - 38 new tests across Rails integration:
89
+ - ControllerHelpers: 26 tests
90
+ - ModelHelpers: 12 tests
91
+
10
92
  ## [0.9.0] - 2025-01-23
11
93
 
12
94
  ### 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-669%20passing-brightgreen)](https://github.com/yourusername/better_seo)
6
- [![Coverage](https://img.shields.io/badge/coverage-95.79%25-brightgreen)](https://github.com/yourusername/better_seo)
5
+ [![Tests](https://img.shields.io/badge/tests-742%20passing-brightgreen)](https://github.com/yourusername/better_seo)
6
+ [![Coverage](https://img.shields.io/badge/coverage-96.12%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.9.0)
12
+ ### ✅ Implemented (v0.11.0)
13
13
 
14
14
  - **Core Configuration System**
15
15
  - Singleton configuration with block-style setup
@@ -32,17 +32,25 @@ 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
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
41
45
 
42
- - **Sitemap Generation**
46
+ - **Sitemap Generation** - Advanced features for large sites
43
47
  - **XML Sitemap Builder**: Fluent API for building sitemaps
44
48
  - **Sitemap Generator**: Generate from blocks, arrays, or model collections
45
49
  - **URL Entry**: Full sitemap.org protocol support (loc, lastmod, changefreq, priority)
50
+ - **Multi-language Support**: hreflang alternates for international sites
51
+ - **Image Sitemaps**: Add images with title and caption to URLs
52
+ - **Video Sitemaps**: Add videos with thumbnail, title, description, duration
53
+ - **Sitemap Index**: Manage large sites with 50,000+ URLs across multiple sitemaps
46
54
  - **Dynamic Generation**: Lambda support for dynamic attributes
47
55
  - **File Writing**: Write sitemaps directly to files
48
56
  - **Rails Integration**: Controller actions and Rake tasks
@@ -68,23 +76,11 @@ A comprehensive SEO gem for Ruby and Rails applications. BetterSeo provides a cl
68
76
 
69
77
  ### 🚧 Planned
70
78
 
71
- - **Advanced Generators** (v0.7.0)
79
+ - **Advanced Generators** (v1.0.0)
72
80
  - Breadcrumbs HTML generator
73
81
  - AMP HTML generator
74
82
  - Canonical URL management
75
83
 
76
- - **Advanced Rails Integration** (v0.7.0)
77
- - Controller helpers for setting page SEO
78
- - Railtie for automatic initialization
79
- - Generator for initializer file
80
- - Automatic meta tags from model attributes
81
-
82
- - **Advanced Sitemap Features** (v0.7.0)
83
- - Multi-language sitemap support (hreflang)
84
- - Sitemap index for large sites (50,000+ URLs)
85
- - Image/video sitemap extensions
86
- - News sitemap support
87
-
88
84
  - **Advanced Features** (v0.6.0+)
89
85
  - robots.txt generator
90
86
  - Image optimization with WebP conversion
@@ -1645,13 +1641,14 @@ bundle exec rspec --format documentation
1645
1641
  ```
1646
1642
 
1647
1643
  Current test statistics:
1648
- - **669 tests** passing
1649
- - **95.79% code coverage** (1205/1258 lines)
1644
+ - **742 tests** passing
1645
+ - **96.12% code coverage** (1364/1419 lines)
1650
1646
  - **3 DSL builders** fully tested
1651
1647
  - **3 HTML generators** fully tested
1652
- - **2 Rails view helper modules** fully tested
1648
+ - **3 Rails helper modules** fully tested (View, Controller, Model)
1653
1649
  - **10 Structured data types** fully tested
1654
- - **1 Sitemap generation system** fully tested
1650
+ - **1 Advanced sitemap system** with hreflang, images, videos, and index
1651
+ - **1 Railtie and Generator** fully tested
1655
1652
  - **1 core configuration system** fully tested
1656
1653
 
1657
1654
  ## Architecture
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BetterSeo
4
- VERSION = "0.9.0"
4
+ VERSION = "0.11.0"
5
5
  end
data/lib/better_seo.rb CHANGED
@@ -16,6 +16,7 @@ require_relative "better_seo/generators/twitter_cards_generator"
16
16
  require_relative "better_seo/sitemap/url_entry"
17
17
  require_relative "better_seo/sitemap/builder"
18
18
  require_relative "better_seo/sitemap/generator"
19
+ require_relative "better_seo/sitemap/sitemap_index"
19
20
  require_relative "better_seo/structured_data/base"
20
21
  require_relative "better_seo/structured_data/organization"
21
22
  require_relative "better_seo/structured_data/article"
@@ -30,6 +31,8 @@ require_relative "better_seo/structured_data/recipe"
30
31
  require_relative "better_seo/structured_data/generator"
31
32
  require_relative "better_seo/rails/helpers/seo_helper"
32
33
  require_relative "better_seo/rails/helpers/structured_data_helper"
34
+ require_relative "better_seo/rails/helpers/controller_helpers"
35
+ require_relative "better_seo/rails/model_helpers"
33
36
 
34
37
  module BetterSeo
35
38
  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.9.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - alessiobussolari