better_seo 0.14.0 → 1.0.0.1

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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +61 -0
  3. data/README.md +297 -179
  4. data/docs/00_OVERVIEW.md +472 -0
  5. data/docs/01_CORE_AND_CONFIGURATION.md +913 -0
  6. data/docs/02_META_TAGS_AND_OPEN_GRAPH.md +251 -0
  7. data/docs/03_STRUCTURED_DATA.md +140 -0
  8. data/docs/04_SITEMAP_AND_ROBOTS.md +131 -0
  9. data/docs/05_RAILS_INTEGRATION.md +175 -0
  10. data/docs/06_I18N_PAGE_GENERATOR.md +233 -0
  11. data/docs/07_IMAGE_OPTIMIZATION.md +260 -0
  12. data/docs/DEPENDENCIES.md +383 -0
  13. data/docs/README.md +180 -0
  14. data/docs/TESTING_STRATEGY.md +663 -0
  15. data/lib/better_seo/analytics/google_analytics.rb +83 -0
  16. data/lib/better_seo/analytics/google_tag_manager.rb +74 -0
  17. data/lib/better_seo/configuration.rb +316 -0
  18. data/lib/better_seo/dsl/base.rb +86 -0
  19. data/lib/better_seo/dsl/meta_tags.rb +55 -0
  20. data/lib/better_seo/dsl/open_graph.rb +109 -0
  21. data/lib/better_seo/dsl/twitter_cards.rb +131 -0
  22. data/lib/better_seo/errors.rb +31 -0
  23. data/lib/better_seo/generators/amp_generator.rb +83 -0
  24. data/lib/better_seo/generators/breadcrumbs_generator.rb +126 -0
  25. data/lib/better_seo/generators/canonical_url_manager.rb +106 -0
  26. data/lib/better_seo/generators/meta_tags_generator.rb +100 -0
  27. data/lib/better_seo/generators/open_graph_generator.rb +110 -0
  28. data/lib/better_seo/generators/robots_txt_generator.rb +102 -0
  29. data/lib/better_seo/generators/twitter_cards_generator.rb +102 -0
  30. data/lib/better_seo/image/optimizer.rb +143 -0
  31. data/lib/better_seo/rails/helpers/controller_helpers.rb +118 -0
  32. data/lib/better_seo/rails/helpers/seo_helper.rb +176 -0
  33. data/lib/better_seo/rails/helpers/structured_data_helper.rb +123 -0
  34. data/lib/better_seo/rails/model_helpers.rb +62 -0
  35. data/lib/better_seo/rails/railtie.rb +22 -0
  36. data/lib/better_seo/sitemap/builder.rb +65 -0
  37. data/lib/better_seo/sitemap/generator.rb +57 -0
  38. data/lib/better_seo/sitemap/sitemap_index.rb +73 -0
  39. data/lib/better_seo/sitemap/url_entry.rb +157 -0
  40. data/lib/better_seo/structured_data/article.rb +55 -0
  41. data/lib/better_seo/structured_data/base.rb +73 -0
  42. data/lib/better_seo/structured_data/breadcrumb_list.rb +49 -0
  43. data/lib/better_seo/structured_data/event.rb +207 -0
  44. data/lib/better_seo/structured_data/faq_page.rb +55 -0
  45. data/lib/better_seo/structured_data/generator.rb +75 -0
  46. data/lib/better_seo/structured_data/how_to.rb +96 -0
  47. data/lib/better_seo/structured_data/local_business.rb +94 -0
  48. data/lib/better_seo/structured_data/organization.rb +67 -0
  49. data/lib/better_seo/structured_data/person.rb +51 -0
  50. data/lib/better_seo/structured_data/product.rb +123 -0
  51. data/lib/better_seo/structured_data/recipe.rb +135 -0
  52. data/lib/better_seo/validators/seo_recommendations.rb +165 -0
  53. data/lib/better_seo/validators/seo_validator.rb +195 -0
  54. data/lib/better_seo/version.rb +1 -1
  55. data/lib/better_seo.rb +1 -0
  56. data/lib/generators/better_seo/install_generator.rb +21 -0
  57. data/lib/generators/better_seo/templates/README +29 -0
  58. data/lib/generators/better_seo/templates/better_seo.rb +40 -0
  59. metadata +55 -2
@@ -0,0 +1,383 @@
1
+ # BetterSeo - Dipendenze
2
+
3
+ Elenco completo di gem e system dependencies necessarie per BetterSeo.
4
+
5
+ ---
6
+
7
+ ## Ruby Version
8
+
9
+ **Richiesto**: Ruby >= 3.0.0
10
+
11
+ **Testato su**:
12
+ - Ruby 3.0.x
13
+ - Ruby 3.1.x
14
+ - Ruby 3.2.x
15
+ - Ruby 3.3.x
16
+
17
+ ---
18
+
19
+ ## Gem Dependencies
20
+
21
+ ### Runtime Dependencies
22
+
23
+ Aggiunte al `better_seo.gemspec`:
24
+
25
+ ```ruby
26
+ spec.add_dependency "activesupport", ">= 6.1"
27
+ ```
28
+ - **Uso**: HashWithIndifferentAccess, Concerns, Core Extensions
29
+ - **Richiesto per**: Configuration, DSL, Rails integration
30
+
31
+ ```ruby
32
+ spec.add_dependency "image_processing", "~> 1.12"
33
+ ```
34
+ - **Uso**: Image optimization wrapper
35
+ - **Richiesto per**: Step 07 (Image Optimization)
36
+ - **Opzionale**: Può essere rimosso se images non utilizzate
37
+
38
+ ```ruby
39
+ spec.add_dependency "ruby-vips", "~> 2.1"
40
+ ```
41
+ - **Uso**: WebP conversion, image resizing
42
+ - **Richiesto per**: Step 07 (Image Optimization)
43
+ - **Opzionale**: Può essere rimosso se images non utilizzate
44
+ - **Alternativa**: Potrebbe usare imagemagick invece di vips
45
+
46
+ ### Development Dependencies
47
+
48
+ ```ruby
49
+ spec.add_development_dependency "rails", ">= 6.1"
50
+ ```
51
+ - **Uso**: Testing Rails integration
52
+ - **Versioni supportate**: Rails 6.1, 7.0, 7.1
53
+
54
+ ```ruby
55
+ spec.add_development_dependency "rspec", "~> 3.0"
56
+ spec.add_development_dependency "rspec-rails", "~> 6.0"
57
+ ```
58
+ - **Uso**: Test framework
59
+ - **Richiesto per**: Tutta la test suite
60
+
61
+ ```ruby
62
+ spec.add_development_dependency "rubocop", "~> 1.21"
63
+ spec.add_development_dependency "rubocop-rspec", "~> 2.0"
64
+ spec.add_development_dependency "rubocop-rails", "~> 2.0"
65
+ ```
66
+ - **Uso**: Code quality, linting
67
+ - **Richiesto per**: CI/CD quality checks
68
+
69
+ ```ruby
70
+ spec.add_development_dependency "simplecov", "~> 0.22"
71
+ ```
72
+ - **Uso**: Code coverage reporting
73
+ - **Richiesto per**: Test coverage metrics
74
+
75
+ ```ruby
76
+ spec.add_development_dependency "factory_bot_rails", "~> 6.0"
77
+ ```
78
+ - **Uso**: Test fixtures
79
+ - **Richiesto per**: Testing con modelli Rails
80
+
81
+ ```ruby
82
+ spec.add_development_dependency "webmock", "~> 3.0"
83
+ ```
84
+ - **Uso**: HTTP mocking per test (ping search engines)
85
+ - **Richiesto per**: Step 04 tests (Sitemap ping)
86
+
87
+ ```ruby
88
+ spec.add_development_dependency "vcr", "~> 6.0"
89
+ ```
90
+ - **Uso**: Record HTTP interactions
91
+ - **Richiesto per**: Integration tests
92
+
93
+ ```ruby
94
+ spec.add_development_dependency "pry-byebug", "~> 3.0"
95
+ ```
96
+ - **Uso**: Debugging
97
+ - **Opzionale**: Development convenience
98
+
99
+ ```ruby
100
+ spec.add_development_dependency "rake", "~> 13.0"
101
+ ```
102
+ - **Uso**: Task runner
103
+ - **Richiesto per**: Rake tasks
104
+
105
+ ---
106
+
107
+ ## System Dependencies
108
+
109
+ ### Obbligatorie
110
+
111
+ **Nessuna** - BetterSeo core funziona senza system dependencies
112
+
113
+ ### Opzionali (per Image Optimization - Step 07)
114
+
115
+ #### libvips (Raccomandato)
116
+
117
+ **Installazione**:
118
+
119
+ ```bash
120
+ # macOS (Homebrew)
121
+ brew install vips
122
+
123
+ # Ubuntu/Debian
124
+ sudo apt-get update
125
+ sudo apt-get install libvips-dev
126
+
127
+ # Fedora/RHEL
128
+ sudo yum install vips-devel
129
+
130
+ # Windows (via scoop)
131
+ scoop install vips
132
+ ```
133
+
134
+ **Verifica installazione**:
135
+ ```bash
136
+ vips --version
137
+ # => vips-8.14.0
138
+ ```
139
+
140
+ **Vantaggi**:
141
+ - Molto più veloce di ImageMagick (4-5x)
142
+ - Memoria usage inferiore
143
+ - Migliore qualità WebP
144
+ - Built-in threading
145
+
146
+ #### ImageMagick (Alternativa)
147
+
148
+ Se libvips non disponibile, fallback su ImageMagick:
149
+
150
+ ```bash
151
+ # macOS
152
+ brew install imagemagick
153
+
154
+ # Ubuntu/Debian
155
+ sudo apt-get install imagemagick libmagickwand-dev
156
+
157
+ # Fedora/RHEL
158
+ sudo yum install ImageMagick ImageMagick-devel
159
+ ```
160
+
161
+ **Verifica**:
162
+ ```bash
163
+ convert --version
164
+ # => Version: ImageMagick 7.1.0
165
+ ```
166
+
167
+ **Gem alternative**:
168
+ ```ruby
169
+ # Se usi ImageMagick invece di vips
170
+ spec.add_dependency "mini_magick", "~> 4.11" # invece di ruby-vips
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Rails Compatibility Matrix
176
+
177
+ | BetterSeo | Rails 6.1 | Rails 7.0 | Rails 7.1 | Ruby 3.0 | Ruby 3.1 | Ruby 3.2 | Ruby 3.3 |
178
+ |-----------|-----------|-----------|-----------|----------|----------|----------|----------|
179
+ | 0.1.0 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
180
+ | 0.2.0+ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
181
+ | 1.0.0 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
182
+
183
+ **Note**:
184
+ - Rails 6.0 e precedenti: non supportati
185
+ - Ruby < 3.0: non supportato
186
+ - ActiveSupport standalone (senza Rails): supportato
187
+
188
+ ---
189
+
190
+ ## Installazione Completa
191
+
192
+ ### Setup Development Environment
193
+
194
+ ```bash
195
+ # 1. Clone repository
196
+ git clone https://github.com/alessiobussolari/better_seo.git
197
+ cd better_seo
198
+
199
+ # 2. Install Ruby dependencies
200
+ bundle install
201
+
202
+ # 3. (Opzionale) Install libvips per images
203
+ brew install vips # macOS
204
+ # oppure
205
+ sudo apt-get install libvips-dev # Ubuntu
206
+
207
+ # 4. Setup test database (se necessario)
208
+ bundle exec rake db:test:prepare
209
+
210
+ # 5. Run tests
211
+ bundle exec rspec
212
+
213
+ # 6. Run linter
214
+ bundle exec rubocop
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Troubleshooting
220
+
221
+ ### Error: `ruby-vips` gem non compila
222
+
223
+ **Problema**: libvips non trovato
224
+
225
+ **Soluzione**:
226
+ ```bash
227
+ # macOS
228
+ brew install vips pkg-config
229
+
230
+ # Ubuntu
231
+ sudo apt-get install libvips-dev pkg-config
232
+
233
+ # Reinstall gem
234
+ gem uninstall ruby-vips
235
+ bundle install
236
+ ```
237
+
238
+ ### Error: ActiveSupport version conflict
239
+
240
+ **Problema**: Conflitto versione Rails/ActiveSupport
241
+
242
+ **Soluzione**:
243
+ ```bash
244
+ # Update bundle
245
+ bundle update activesupport
246
+
247
+ # Oppure specifica versione Rails nel Gemfile.lock
248
+ bundle install --conservative
249
+ ```
250
+
251
+ ### Warning: SimpleCov non genera coverage
252
+
253
+ **Problema**: simplecov non carica
254
+
255
+ **Soluzione**:
256
+ ```ruby
257
+ # spec/spec_helper.rb - deve essere PRIMO require
258
+ require 'simplecov'
259
+ SimpleCov.start 'rails'
260
+
261
+ require 'better_seo'
262
+ # ... altri requires
263
+ ```
264
+
265
+ ---
266
+
267
+ ## Gem Opzionali per Produzione
268
+
269
+ ### Per Performance
270
+
271
+ ```ruby
272
+ gem "oj" # Fast JSON parsing
273
+ ```
274
+ - Uso: JSON-LD generation più veloce
275
+ - Speedup: ~2x su structured data
276
+
277
+ ### Per Caching
278
+
279
+ ```ruby
280
+ gem "redis" # Per cache sitemap/robots
281
+ gem "redis-rails" # Rails cache backend
282
+ ```
283
+ - Uso: Cache sitemap generation
284
+ - Beneficio: Sitemap >10k URLs molto più veloce
285
+
286
+ ### Per Cloud Storage
287
+
288
+ ```ruby
289
+ gem "aws-sdk-s3" # Amazon S3
290
+ gem "google-cloud-storage" # Google Cloud
291
+ gem "azure-storage-blob" # Microsoft Azure
292
+ ```
293
+ - Uso: Upload immagini ottimizzate su cloud
294
+ - Opzionale: Solo se usi cloud storage
295
+
296
+ ---
297
+
298
+ ## CI/CD Dependencies
299
+
300
+ ### GitHub Actions
301
+
302
+ ```yaml
303
+ # .github/workflows/ci.yml
304
+ - uses: ruby/setup-ruby@v1
305
+ with:
306
+ ruby-version: 3.3
307
+ bundler-cache: true
308
+
309
+ # Installa libvips per image tests
310
+ - name: Install libvips
311
+ run: sudo apt-get install libvips-dev
312
+ ```
313
+
314
+ ### CircleCI
315
+
316
+ ```yaml
317
+ # .circleci/config.yml
318
+ - run:
319
+ name: Install libvips
320
+ command: |
321
+ sudo apt-get update
322
+ sudo apt-get install libvips-dev
323
+ ```
324
+
325
+ ---
326
+
327
+ ## Minimal vs Full Installation
328
+
329
+ ### Minimal (Solo Meta Tags e SEO base)
330
+
331
+ ```ruby
332
+ # Gemfile
333
+ gem "better_seo"
334
+
335
+ # No system dependencies required
336
+ ```
337
+
338
+ **Funzionalità disponibili**:
339
+ - ✅ Meta tags
340
+ - ✅ Open Graph
341
+ - ✅ Twitter Cards
342
+ - ✅ Structured Data
343
+ - ✅ Sitemap
344
+ - ✅ Robots.txt
345
+ - ❌ Image optimization (non disponibile)
346
+
347
+ ### Full (Con Image Optimization)
348
+
349
+ ```ruby
350
+ # Gemfile
351
+ gem "better_seo"
352
+
353
+ # System: libvips installato
354
+ ```
355
+
356
+ **Funzionalità disponibili**:
357
+ - ✅ Tutte le features minimal
358
+ - ✅ Image optimization
359
+ - ✅ WebP conversion
360
+ - ✅ Responsive images
361
+ - ✅ Lazy loading
362
+
363
+ ---
364
+
365
+ ## Verifica Dipendenze
366
+
367
+ ```bash
368
+ # Check gem dependencies
369
+ bundle list
370
+
371
+ # Check for security vulnerabilities
372
+ bundle audit
373
+
374
+ # Check for outdated gems
375
+ bundle outdated
376
+
377
+ # Verifica libvips (se installato)
378
+ ruby -e "require 'vips'; puts Vips::version_string"
379
+ ```
380
+
381
+ ---
382
+
383
+ **Ultima modifica**: 2025-10-22
data/docs/README.md ADDED
@@ -0,0 +1,180 @@
1
+ # Better SEO - Piano di Implementazione
2
+
3
+ Documentazione completa per l'implementazione di BetterSeo gem.
4
+
5
+ ---
6
+
7
+ ## Indice
8
+
9
+ ### Panoramica
10
+ - **[00_OVERVIEW.md](00_OVERVIEW.md)** - Visione generale, architettura, roadmap completa
11
+
12
+ ### Step di Implementazione
13
+
14
+ 1. **[01_CORE_AND_CONFIGURATION.md](01_CORE_AND_CONFIGURATION.md)** - v0.2.0
15
+ - Sistema configurazione YAML/JSON
16
+ - DSL base pattern
17
+ - Custom errors
18
+ - Rails Railtie
19
+ - **Durata**: 1-2 settimane | **Priorità**: 🔴 CRITICA
20
+
21
+ 2. **[02_META_TAGS_AND_OPEN_GRAPH.md](02_META_TAGS_AND_OPEN_GRAPH.md)** - v0.3.0
22
+ - Meta tags HTML
23
+ - Open Graph protocol
24
+ - Twitter Cards
25
+ - Validatori e generators
26
+ - **Durata**: 2-3 settimane | **Priorità**: 🔴 CRITICA
27
+
28
+ 3. **[03_STRUCTURED_DATA.md](03_STRUCTURED_DATA.md)** - v0.4.0
29
+ - Schema.org types
30
+ - JSON-LD generator
31
+ - Article, Product, Organization, Person, Breadcrumb
32
+ - **Durata**: 2-3 settimane | **Priorità**: 🟡 MEDIA
33
+
34
+ 4. **[04_SITEMAP_AND_ROBOTS.md](04_SITEMAP_AND_ROBOTS.md)** - v0.5.0
35
+ - Sitemap XML generator
36
+ - Robots.txt generator
37
+ - Dynamic sitemap da models
38
+ - Rake tasks
39
+ - **Durata**: 1-2 settimane | **Priorità**: 🟡 MEDIA
40
+
41
+ 5. **[05_RAILS_INTEGRATION.md](05_RAILS_INTEGRATION.md)** - v0.6.0
42
+ - View helpers completi
43
+ - Controller concerns
44
+ - Rails generators
45
+ - Engine e routes
46
+ - **Durata**: 2 settimane | **Priorità**: 🔴 ALTA
47
+
48
+ 6. **[06_I18N_PAGE_GENERATOR.md](06_I18N_PAGE_GENERATOR.md)** - v0.7.0
49
+ - Generatore pagine multilingua
50
+ - File YAML per locale
51
+ - Helper `set_seo_from_locale`
52
+ - Validazione traduzioni
53
+ - **Durata**: 1-2 settimane | **Priorità**: 🟢 BASSA
54
+
55
+ 7. **[07_IMAGE_OPTIMIZATION.md](07_IMAGE_OPTIMIZATION.md)** - v0.8.0
56
+ - Conversione WebP
57
+ - Resize automatico
58
+ - Helper `seo_image_tag`
59
+ - Active Storage/CarrierWave/Shrine integration
60
+ - **Durata**: 2-3 settimane | **Priorità**: 🟢 BASSA
61
+
62
+ ### Documentazione di Supporto
63
+
64
+ - **[DEPENDENCIES.md](DEPENDENCIES.md)** - Gem e system dependencies necessarie
65
+ - **[TESTING_STRATEGY.md](TESTING_STRATEGY.md)** - Strategia testing con RSpec
66
+
67
+ ---
68
+
69
+ ## Quick Start
70
+
71
+ ### 1. Preparazione Ambiente
72
+
73
+ ```bash
74
+ # Installa dipendenze
75
+ bundle install
76
+
77
+ # Setup database test (se necessario)
78
+ bundle exec rake db:test:prepare
79
+
80
+ # Verifica setup
81
+ bundle exec rspec --version
82
+ bundle exec rubocop --version
83
+ ```
84
+
85
+ ### 2. Workflow di Sviluppo
86
+
87
+ ```bash
88
+ # 1. Crea branch per lo step
89
+ git checkout -b feature/step-01-core
90
+
91
+ # 2. Implementa seguendo la documentazione dello step
92
+ # Vedi docs/01_CORE_AND_CONFIGURATION.md
93
+
94
+ # 3. Esegui test
95
+ bundle exec rspec
96
+
97
+ # 4. Verifica code quality
98
+ bundle exec rubocop
99
+
100
+ # 5. Commit e push
101
+ git commit -m "Implement Step 01: Core and Configuration"
102
+ git push origin feature/step-01-core
103
+ ```
104
+
105
+ ### 3. Ordine Raccomandato
106
+
107
+ **MVP (Minimum Viable Product)**:
108
+ 1. Step 01 (Core)
109
+ 2. Step 02 (Meta Tags)
110
+ 3. Step 05 (Rails - parziale)
111
+
112
+ **Full Features**:
113
+ 4. Step 03 (Structured Data)
114
+ 5. Step 04 (Sitemap)
115
+ 6. Step 05 (Rails - completo)
116
+ 7. Step 06 (i18n)
117
+ 8. Step 07 (Images)
118
+
119
+ ---
120
+
121
+ ## Metriche di Successo
122
+
123
+ ### Per Ogni Step
124
+
125
+ - ✅ Test coverage > 90%
126
+ - ✅ Rubocop compliant (0 offenses)
127
+ - ✅ Tutti i test passano (green)
128
+ - ✅ Documentation aggiornata
129
+ - ✅ CHANGELOG.md aggiornato
130
+
131
+ ### Per Release
132
+
133
+ **v0.3.0 (MVP)**:
134
+ - [ ] Meta tags funzionanti
135
+ - [ ] Open Graph funzionante
136
+ - [ ] Rails helpers base
137
+ - [ ] Gem installabile
138
+
139
+ **v1.0.0 (Production)**:
140
+ - [ ] Tutte le features implementate
141
+ - [ ] Test coverage > 90%
142
+ - [ ] Performance < 5ms overhead
143
+ - [ ] Documentation completa
144
+ - [ ] Published su RubyGems.org
145
+
146
+ ---
147
+
148
+ ## Risorse Utili
149
+
150
+ ### Documentation
151
+ - [Schema.org](https://schema.org/)
152
+ - [Open Graph Protocol](https://ogp.me/)
153
+ - [Twitter Cards](https://developer.twitter.com/en/docs/twitter-for-websites/cards)
154
+ - [Google SEO Guide](https://developers.google.com/search/docs)
155
+
156
+ ### Tools
157
+ - [Google Rich Results Test](https://search.google.com/test/rich-results)
158
+ - [Facebook Sharing Debugger](https://developers.facebook.com/tools/debug/)
159
+ - [Twitter Card Validator](https://cards-dev.twitter.com/validator)
160
+
161
+ ### Gem Development
162
+ - [RubyGems Guides](https://guides.rubygems.org/)
163
+ - [Bundler Gem Development](https://bundler.io/guides/creating_gem.html)
164
+ - [RSpec Best Practices](https://rspec.info/documentation/)
165
+
166
+ ---
167
+
168
+ ## Supporto
169
+
170
+ Per domande o problemi durante l'implementazione:
171
+
172
+ 1. Consulta la documentazione dello step specifico
173
+ 2. Verifica `DEPENDENCIES.md` per system requirements
174
+ 3. Controlla `TESTING_STRATEGY.md` per testing approach
175
+ 4. Apri issue su GitHub per bug/questions
176
+
177
+ ---
178
+
179
+ **Ultima modifica**: 2025-10-22
180
+ **Versione**: 1.0