meta-tags 2.23.0 → 2.25.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: 8b4bb486b4a8b270f4e782ad51e97e5df1e48c494226f28c4242aaf17b4a20a3
4
- data.tar.gz: 43ff472ad6406ee187d1234eb363d6a9a9d9360c460b651bfcf00ab503a62d01
3
+ metadata.gz: 7c6d1c85b9d903246781e74a1439f526c945fdc7ef0efab54b8ea1398e708dac
4
+ data.tar.gz: d3ab4d7ed33f4dd83a9c73d9b7da9d4ae40685b19affd790a2c393fc7f0aba8f
5
5
  SHA512:
6
- metadata.gz: 98406f57fb0efc987f850478b5178c95634785853fdda24898aecde45b40893920c3533b86627d12e8a5b2cdd7526fb3a7c15b44617087c2029cb2329dac2908
7
- data.tar.gz: dde7d53752a74f005e5ddafafea009c17aad3e67f119e825f5478285421c041060b7b766d7bcdb04bd4fb1bdea0d892a59b8a84e9c348ef55786b90b12c9a189
6
+ metadata.gz: 7db6e7d7fff2d445eb937d6aa4ebd86f75e79fa444f3e19d5884bfdf0f4c434e497d14ca66911f102453d74f82aaa05ff508021e517f2ce2248cebcb36c23d77
7
+ data.tar.gz: 6c3a4d47c58ea86f28d1fdb060c5eed7466038c2b76100b588b542bcfd42ce3ecbfab430fcb6c854adf0ee53c5b5270248f70c6de77d24d85db11ee27dfb2a6b
checksums.yaml.gz.sig CHANGED
Binary file
data/AGENTS.md ADDED
@@ -0,0 +1,4 @@
1
+ # Changelog
2
+
3
+ - Document substantial user-visible changes, including features, bug fixes, performance improvements, and compatibility changes, in the `Unreleased` section of `CHANGELOG.md`. Describe the effect on users and follow the existing section style.
4
+ - Documentation-only edits, test-only edits, and internal refactors with no user-visible effect do not need a changelog entry.
data/CHANGELOG.md CHANGED
@@ -2,6 +2,101 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.25.0 (November 29, 2026) [☰](https://github.com/kpumuk/meta-tags/compare/v2.24.0...v2.25.0)
6
+
7
+ Bugfixes:
8
+
9
+ - Allowed `Time`, `Date`, `DateTime`, and `ActiveSupport::TimeWithZone` values in `title_tag_attributes` in RBS, including nested `data` attributes, to match the existing runtime rendering ([456](https://github.com/kpumuk/meta-tags/pull/456)).
10
+ - Made `skip_canonical_links_on_noindex` treat a standalone robots `none` directive as equivalent to `noindex, nofollow`, while leaving valued directives such as `max-image-preview:none` unaffected ([426](https://github.com/kpumuk/meta-tags/pull/426)).
11
+ - Made the `lowercase` title option transform decoded text instead of raw HTML, so numeric character references are lowercased and case-sensitive named entities retain their intended symbols ([427](https://github.com/kpumuk/meta-tags/pull/427)).
12
+ - Normalized site-only title fallbacks for mirrored titles and the `title` helper, applying text cleanup and title length limits while preserving site casing ([450](https://github.com/kpumuk/meta-tags/pull/450)).
13
+ - Allowed an explicit `nil` title in the `title` helper RBS signature, matching the existing runtime behavior ([428](https://github.com/kpumuk/meta-tags/pull/428)).
14
+ - Allowed `nil` for `keywords_limit` in RBS to match the existing unlimited-keywords runtime behavior ([451](https://github.com/kpumuk/meta-tags/pull/451)).
15
+ - Applied controller `@page_title`, `@page_description`, and `@page_keywords` metadata during `render_to_string`, matching ordinary template rendering ([454](https://github.com/kpumuk/meta-tags/pull/454)).
16
+ - Compared crawler names case-insensitively in robots handling. Robots helpers now apply `follow` over `nofollow` and `noindex` over `index` when targets differ only in case, using the first spelling supplied, and `skip_canonical_links_on_noindex` recognizes mixed-case custom `robots`, `googlebot`, and `bingbot` tags such as `"Robots" => "noindex"` ([457](https://github.com/kpumuk/meta-tags/pull/457)).
17
+ - Made the privileged Dependabot lockfile workflow match artifact names literally against the pull request's existing lockfiles, so names starting with a dash can no longer bypass the allowlist ([458](https://github.com/kpumuk/meta-tags/pull/458)).
18
+ - Renewed the gem signing certificate, which expired on September 29, 2026, so releases can be signed again and installed with a RubyGems trust policy such as `gem install meta-tags -P MediumSecurity`. A weekly check now fails 30 days before the certificate expires ([464](https://github.com/kpumuk/meta-tags/pull/464)).
19
+ - Dropped the contents of `<script>` and `<style>` elements when stripping HTML from titles, descriptions, and keywords, matching Rails' `strip_tags`. Inline scripts, JSON blobs, and CSS no longer appear in `<meta name="description">` or mirrored tags such as `og:description`. As in browsers, an unclosed `<script>` or `<style>` hides the rest of the value ([465](https://github.com/kpumuk/meta-tags/pull/465)).
20
+ - Dropped attribute names that are blank once converted to a string, such as `""`, `" "`, or `:" "`, from `icon`, `alternate`, and `title_tag_attributes` hashes and the `data` and `aria` hashes nested in them. Rails 6.1 through 7.2, 8.0 before 8.0.5.2, and 8.1 before 8.1.4.1 render such a name as a nameless attribute, so its value could be parsed as further attributes, such as an event handler (CVE-2026-33168, GHSA-68p9-83h6-5wpj). Output on patched Rails versions is unchanged ([470](https://github.com/kpumuk/meta-tags/pull/470)).
21
+
22
+ Changes:
23
+
24
+ - Ruby 3.2 is now the minimum supported version. Ruby 3.0 and 3.1 are no longer supported ([444](https://github.com/kpumuk/meta-tags/pull/444)).
25
+ - Rails 6.1 is now the minimum version the gem declares, matching the documented and tested support. Rails 6.0 was never tested; on Rails 6.0, Bundler keeps resolving `meta-tags` to 2.24.0, and requiring a newer version fails to resolve because it depends on `actionpack >= 6.1.0` ([469](https://github.com/kpumuk/meta-tags/pull/469)).
26
+ - Avoided HTML parsing for plain UTF-8 ASCII metadata text while preserving normalization and escaping behavior ([452](https://github.com/kpumuk/meta-tags/pull/452)).
27
+ - Avoided normalizing or validating discarded keyword suffixes in large arrays with a positive character limit, while keeping small arrays on the eager path ([453](https://github.com/kpumuk/meta-tags/pull/453)).
28
+ - Bounded the HTML parsing cost of long `title`, `description`, and `keywords` values when a positive character limit applies: only the part of each value before its 2,049th `<` is read at the default limits (four times the limit for limits above 512), so rendering a large HTML body as a description no longer slows down with the amount of markup in it. Text behind more markup than that is ignored, and every `<` counts, including those inside scripts. Long attribute values such as inline images are read whole. Unlimited configurations (`nil` or `0` limits) still read the whole value ([468](https://github.com/kpumuk/meta-tags/pull/468)).
29
+ - Hardened the release workflow: it installs dependencies before building the gem and installs them frozen to the committed lockfile, so publishing never uses a fresh dependency resolution ([422](https://github.com/kpumuk/meta-tags/pull/422), [471](https://github.com/kpumuk/meta-tags/pull/471)).
30
+
31
+ ## 2.24.0 (September 1, 2026) [☰](https://github.com/kpumuk/meta-tags/compare/v2.23.0...v2.24.0)
32
+
33
+ Features:
34
+
35
+ - Added the `truncate_array_items_at_boundaries` option for `title` and `keywords` arrays. When enabled, multi-item arrays stop before an overflowing item instead of cutting that item in the middle. The first or only item can still be truncated, so a non-empty value does not become empty ([354](https://github.com/kpumuk/meta-tags/pull/354)).
36
+
37
+ ```ruby
38
+ MetaTags.configure do |config|
39
+ config.title_limit = 12
40
+ config.truncate_array_items_at_boundaries = true
41
+ end
42
+
43
+ display_meta_tags(title: ["Shoes", "Running", "Men"])
44
+ # => <title>Shoes</title>
45
+ # With the option disabled: <title>Shoes | Runn</title>
46
+ ```
47
+
48
+ - Added hash-based custom directives for `robots`, `googlebot`, and `bingbot`. `nil` and `true` produce valueless directives, `false` omits a directive, and other values use `name:value`; existing robots helpers and legacy scalar and array values remain supported ([224](https://github.com/kpumuk/meta-tags/pull/224), rebased in [361](https://github.com/kpumuk/meta-tags/pull/361), corrected in [406](https://github.com/kpumuk/meta-tags/pull/406)).
49
+
50
+ ```ruby
51
+ display_meta_tags(
52
+ robots: {
53
+ "max-snippet" => -1,
54
+ "max-video-preview" => -1
55
+ }
56
+ )
57
+ # => <meta name="robots" content="max-snippet:-1, max-video-preview:-1">
58
+ ```
59
+
60
+ Bugfixes:
61
+
62
+ - Made `skip_canonical_links_on_noindex` follow the directives that are actually rendered. Empty crawler lists and blank crawler names no longer suppress canonical links, while effective `noindex` directives in custom `robots`, `googlebot`, and `bingbot` values do ([405](https://github.com/kpumuk/meta-tags/pull/405), [413](https://github.com/kpumuk/meta-tags/pull/413), [416](https://github.com/kpumuk/meta-tags/pull/416)).
63
+ - Preserved legacy scalar and array custom robots values instead of treating every value as a directive hash. This also fixes valueless directives being serialized with a trailing colon and disabled directives being rendered as `name:false` ([406](https://github.com/kpumuk/meta-tags/pull/406)).
64
+ - Preserved an inherited `itemprop` on anonymous values inside recursively structured metadata, including arrays of Open Graph images. Named subproperties still do not inherit the attribute, and an explicit nested value still wins ([410](https://github.com/kpumuk/meta-tags/pull/410)).
65
+ - Suppressed icon and array-form alternate links when their URL is `nil` or blank, instead of rendering unusable `href=""` elements ([411](https://github.com/kpumuk/meta-tags/pull/411)).
66
+ - Fixed `MetaTagsCollection#page_title` when `site` is supplied through method defaults. It now excludes the site while `full_title` continues to include it ([412](https://github.com/kpumuk/meta-tags/pull/412)).
67
+
68
+ ```ruby
69
+ collection.page_title(site: "Site", title: "Page") # => "Page"
70
+ collection.full_title(site: "Site", title: "Page") # => "Site | Page"
71
+ ```
72
+
73
+ - Deep-merged the `og` and `open_graph` aliases when both appear in one input hash, instead of silently discarding the canonical `og` value. `og` wins conflicting leaves in the same input; separate updates retain their existing last-update precedence ([414](https://github.com/kpumuk/meta-tags/pull/414)).
74
+ - Aligned the packaged RBS contracts with existing runtime behavior: `description_limit` accepts `nil`, `title_tag_attributes` accepts Rails-style nested arrays and numeric or boolean values, and recursive metadata accepts finite `Float` values ([415](https://github.com/kpumuk/meta-tags/pull/415), [418](https://github.com/kpumuk/meta-tags/pull/418), [419](https://github.com/kpumuk/meta-tags/pull/419)).
75
+ - Fixed the `lowercase` title option so it is consumed even when the page title is absent, rather than leaking into `<meta name="lowercase">`. String-like title values implementing `#to_str` are now coerced before lowercasing instead of raising `NoMethodError` ([420](https://github.com/kpumuk/meta-tags/pull/420)).
76
+
77
+ Changes:
78
+
79
+ - **MetaTags 3.0 migration:** direct Symbols in nested custom-tag arrays now emit a deprecation warning. MetaTags 2.x still renders them literally by default; set `resolve_symbolic_references_in_arrays = true` to opt in to 3.0 reference semantics now, and use Strings for values that should remain literal. Direct hash references, explicit `{_: ...}` references, top-level arrays, and specialized arrays keep their existing behavior ([409](https://github.com/kpumuk/meta-tags/pull/409)).
80
+
81
+ ```ruby
82
+ MetaTags.configure do |config|
83
+ config.resolve_symbolic_references_in_arrays = true
84
+ end
85
+
86
+ display_meta_tags(
87
+ image_src: "https://example.com/image.png",
88
+ og: {image: [:image_src]}
89
+ )
90
+ # => <link rel="image_src" href="https://example.com/image.png">
91
+ # <meta property="og:image" content="https://example.com/image.png">
92
+ ```
93
+
94
+ - Made README rendering examples executable regression tests and repaired confirmed dead reference links, reducing the chance that documented output drifts from the renderer ([404](https://github.com/kpumuk/meta-tags/pull/404), [417](https://github.com/kpumuk/meta-tags/pull/417)).
95
+ - Made the `steep` Rake task propagate type-checking failures and reconciled the RBS signatures with the current Ruby implementation, so CI can no longer report success after Steep errors ([407](https://github.com/kpumuk/meta-tags/pull/407)).
96
+ - Refreshed the supported development lockfiles, split Ruby 3.1 compatibility locks where patched dependencies require newer Ruby, and added an advisory audit covering every committed supported lockfile ([408](https://github.com/kpumuk/meta-tags/pull/408)).
97
+ - Hardened GitHub Actions by removing untrusted checkouts from the privileged Dependabot workflow, declaring token permissions, adding stable required checks and a security policy, and enforcing OpenSSF Scorecards and pedantic zizmor checks ([357](https://github.com/kpumuk/meta-tags/pull/357), [358](https://github.com/kpumuk/meta-tags/pull/358), [359](https://github.com/kpumuk/meta-tags/pull/359), [360](https://github.com/kpumuk/meta-tags/pull/360), [362](https://github.com/kpumuk/meta-tags/pull/362), [374](https://github.com/kpumuk/meta-tags/pull/374)).
98
+ - Updated the GitHub Actions toolchain throughout the release cycle, including `actions/checkout`, artifact upload, GitHub App authentication, `ruby/setup-ruby`, RubyGems release automation, Scorecards, and zizmor ([367](https://github.com/kpumuk/meta-tags/pull/367), [376](https://github.com/kpumuk/meta-tags/pull/376), [397](https://github.com/kpumuk/meta-tags/pull/397), [399](https://github.com/kpumuk/meta-tags/pull/399), [401](https://github.com/kpumuk/meta-tags/pull/401), [402](https://github.com/kpumuk/meta-tags/pull/402), [403](https://github.com/kpumuk/meta-tags/pull/403)).
99
+
5
100
  ## 2.23.0 (March 16, 2026) [☰](https://github.com/kpumuk/meta-tags/compare/v2.22.3...v2.23.0)
6
101
 
7
102
  Bugfixes:
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![Tests](https://github.com/kpumuk/meta-tags/actions/workflows/tests.yml/badge.svg)](https://github.com/kpumuk/meta-tags/actions/workflows/tests.yml)
4
4
  [![Gem Version](https://badge.fury.io/rb/meta-tags.svg)](https://badge.fury.io/rb/meta-tags)
5
+ [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/kpumuk/meta-tags/badge)](https://scorecard.dev/viewer/?uri=github.com/kpumuk/meta-tags)
5
6
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
6
7
  [![Gem Downloads](https://img.shields.io/gem/dt/meta-tags.svg)](https://badge.fury.io/rb/meta-tags)
7
8
  [![Changelog](https://img.shields.io/badge/Changelog-latest-blue.svg)](https://github.com/kpumuk/meta-tags/blob/main/CHANGELOG.md)
@@ -15,7 +16,7 @@ It supports the metadata layer of search engine optimization (SEO), especially f
15
16
  The MetaTags main branch fully supports Ruby on Rails 6.1+ and is tested against all major Ruby on Rails releases.
16
17
 
17
18
  > [!NOTE]
18
- > We no longer support Ruby versions older than 3.0 and Ruby on Rails older than 6.1 since they reached their end of life (see [Ruby](https://endoflife.date/ruby) and [Ruby on Rails](https://endoflife.date/rails)).
19
+ > MetaTags requires Ruby 3.2+ and Ruby on Rails 6.1+. Older Rails release series that MetaTags still supports may no longer receive security fixes from the Rails team; see the [Rails maintenance policy](https://rubyonrails.org/maintenance).
19
20
 
20
21
  > [!IMPORTANT]
21
22
  > MetaTags manages HTML head metadata. It does not generate structured data / JSON-LD, `robots.txt`, sitemaps, internal links, or page content.
@@ -40,6 +41,25 @@ To override the defaults, create an initializer `config/initializers/meta_tags.r
40
41
  rails generate meta_tags:install
41
42
  ```
42
43
 
44
+ When a truncation limit is reached, arrays passed to `title` or `keywords` can
45
+ either partially truncate the last item or stop at item boundaries. Set
46
+ `config.truncate_array_items_at_boundaries = true` to preserve whole items for
47
+ multi-item arrays. Single-item arrays are still truncated normally.
48
+
49
+ Symbols in nested custom tag arrays are literal values in MetaTags 2.x.
50
+ MetaTags 3.0 will use them to look up normalized top-level tags. You can turn
51
+ on this behavior now. Until then, each nested array that contains a direct
52
+ Symbol value emits a deprecation warning:
53
+
54
+ ```ruby
55
+ MetaTags.configure do |config|
56
+ config.resolve_symbolic_references_in_arrays = true
57
+ end
58
+ ```
59
+
60
+ When this option is on, use Strings for literal array values. MetaTags does not
61
+ render a tag when a Symbol has no match.
62
+
43
63
  By default, meta tags are rendered with the key `name`. However, some meta tags are required to use `property` instead (like Facebook Open Graph object). The MetaTags gem allows you to configure which tags to render with the `property` attribute. The pre-configured list includes all possible Facebook Open Graph object types by default, but you can add your own in case you need it.
44
64
 
45
65
  ## MetaTags Usage
@@ -148,7 +168,7 @@ If you want to set the title and display another text, use this:
148
168
 
149
169
  ### Allowed options for `display_meta_tags` and `set_meta_tags` methods
150
170
 
151
- Use these options to customize the title format:
171
+ Use these options to customize the generated tags:
152
172
 
153
173
  | Option | Description |
154
174
  | -------------- | ------------------------------------------------------------------------------------------------------------------- |
@@ -167,6 +187,9 @@ Use these options to customize the title format:
167
187
  | `:nofollow` | Add nofollow meta tag; when true, "robots" will be used; accepts a string with a robot name or an array of strings |
168
188
  | `:follow` | Add follow meta tag; when true, "robots" will be used; accepts a string with a robot name or an array of strings |
169
189
  | `:noarchive` | Add noarchive meta tag; when true, "robots" will be used; accepts a string with a robot name or an array of strings |
190
+ | `:robots` | Add custom directives to the `robots` meta tag (Hash) |
191
+ | `:googlebot` | Add custom directives to the `googlebot` meta tag (Hash) |
192
+ | `:bingbot` | Add custom directives to the `bingbot` meta tag (Hash) |
170
193
  | `:canonical` | Add canonical link tag |
171
194
  | `:prev` | Add legacy prev pagination link tag |
172
195
  | `:next` | Add legacy next pagination link tag |
@@ -297,6 +320,8 @@ These tags still matter for search snippets, canonicalization, robots directives
297
320
 
298
321
  Page titles help browsers, social previews, and search engines understand the page. Use unique, descriptive titles that match the visible page content.
299
322
 
323
+ <!-- executable-example: titles -->
324
+
300
325
  ```ruby
301
326
  set_meta_tags title: "Member Login"
302
327
  # <title>Member Login</title>
@@ -319,6 +344,8 @@ Description meta tags help search engines generate snippets, but search engines
319
344
 
320
345
  Below is an example of how to set a description tag using Ruby:
321
346
 
347
+ <!-- executable-example: description -->
348
+
322
349
  ```ruby
323
350
  set_meta_tags description: "This is a sample description"
324
351
  # <meta name="description" content="This is a sample description">
@@ -336,6 +363,8 @@ Further reading:
336
363
 
337
364
  The `keywords` tag is a legacy feature. MetaTags still supports it for backwards compatibility and for systems that still read it, but it is not a modern web SEO signal.
338
365
 
366
+ <!-- executable-example: keywords -->
367
+
339
368
  ```ruby
340
369
  set_meta_tags keywords: %w[keyword1 keyword2 keyword3]
341
370
  # <meta name="keywords" content="keyword1, keyword2, keyword3">
@@ -352,6 +381,8 @@ Further reading:
352
381
 
353
382
  By using the noindex meta tag, you can signal to search engines not to include specific pages in their indexes.
354
383
 
384
+ <!-- executable-example: noindex -->
385
+
355
386
  ```ruby
356
387
  set_meta_tags noindex: true
357
388
  # <meta name="robots" content="noindex">
@@ -371,6 +402,8 @@ Further reading:
371
402
 
372
403
  In most cases, you do not need to emit `index` explicitly because it is already the default for crawlable pages.
373
404
 
405
+ <!-- executable-example: index -->
406
+
374
407
  ```ruby
375
408
  set_meta_tags index: true
376
409
  # <meta name="robots" content="index">
@@ -380,6 +413,8 @@ set_meta_tags index: true
380
413
 
381
414
  Nofollow meta tags tell a search engine not to follow the links on a specific page. It is entirely possible that a robot might find the same links on another page without a nofollow attribute, perhaps on another site, and still arrive at your undesired page.
382
415
 
416
+ <!-- executable-example: nofollow -->
417
+
383
418
  ```ruby
384
419
  set_meta_tags nofollow: true
385
420
  # <meta name="robots" content="nofollow">
@@ -389,7 +424,7 @@ set_meta_tags nofollow: "googlebot"
389
424
 
390
425
  Further reading:
391
426
 
392
- - [About rel="nofollow"](http://www.google.com/support/webmasters/bin/answer.py?answer=96569)
427
+ - [About rel="nofollow"](https://developers.google.com/search/docs/crawling-indexing/qualify-outbound-links)
393
428
  - [Meta tags](http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=79812)
394
429
  - [Google Search Central: robots meta tag and X-Robots-Tag](https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag)
395
430
 
@@ -397,6 +432,8 @@ Further reading:
397
432
 
398
433
  You can use `follow` with `noindex` if you need that combination, but most pages do not need an explicit `follow` tag because it is also the default behavior.
399
434
 
435
+ <!-- executable-example: follow -->
436
+
400
437
  ```ruby
401
438
  set_meta_tags noindex: true, follow: true
402
439
  # <meta name="robots" content="noindex, follow">
@@ -404,6 +441,39 @@ set_meta_tags noindex: true, follow: true
404
441
 
405
442
  This tag will prevent search engines from indexing this specific page, but it will still allow them to crawl and index the remaining pages on your website.
406
443
 
444
+ ### Robots
445
+
446
+ Use the `robots`, `googlebot`, and `bingbot` hashes when you need directives beyond `index`, `noindex`, `follow`, `nofollow`, and `noarchive`.
447
+
448
+ This is useful for directives such as `max-snippet`, `max-video-preview`, and `unavailable_after`.
449
+
450
+ <!-- executable-example: robots -->
451
+
452
+ ```ruby
453
+ set_meta_tags robots: {
454
+ "max-snippet" => -1,
455
+ "max-video-preview" => -1
456
+ }
457
+ # <meta name="robots" content="max-snippet:-1, max-video-preview:-1">
458
+
459
+ set_meta_tags googlebot: {
460
+ unavailable_after: "2026-12-31"
461
+ }
462
+ # <meta name="googlebot" content="unavailable_after:2026-12-31">
463
+
464
+ set_meta_tags bingbot: {
465
+ "max-image-preview" => "large"
466
+ }
467
+ # <meta name="bingbot" content="max-image-preview:large">
468
+ ```
469
+
470
+ These hashes are merged with the existing robots helpers, so `noindex`, `nofollow`, and similar directives still render first for the same meta tag.
471
+
472
+ Further reading:
473
+
474
+ - [Google Search Central: robots meta tag and X-Robots-Tag](https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag)
475
+ - [Bing Webmaster Guidelines: robots meta tag support](https://www.bing.com/webmasters/help/which-robots-metatags-does-bing-support-5198d240)
476
+
407
477
  ### Canonical URL
408
478
 
409
479
  Canonical link elements help search engines consolidate duplicate or near-duplicate URLs under one preferred URL. They are a signal, not a guarantee.
@@ -411,6 +481,8 @@ Canonical link elements help search engines consolidate duplicate or near-duplic
411
481
  > [!NOTE]
412
482
  > If your goal is duplicate consolidation, prefer a canonical URL over `noindex`. If you do not want to mix canonical with `noindex`, set `MetaTags.config.skip_canonical_links_on_noindex = true`.
413
483
 
484
+ <!-- executable-example: canonical -->
485
+
414
486
  ```ruby
415
487
  set_meta_tags canonical: "http://yoursite.com/canonical/url"
416
488
  # <link rel="canonical" href="http://yoursite.com/canonical/url">
@@ -426,17 +498,19 @@ Further reading:
426
498
 
427
499
  A favicon (short for Favorite icon), also known as a shortcut icon, website icon, tab icon, or bookmark icon, is a file containing one or more small icons, most commonly 16x16 pixels, associated with a particular website or web page.
428
500
 
501
+ <!-- executable-example: icons -->
502
+
429
503
  ```ruby
430
504
  set_meta_tags icon: "/favicon.ico"
431
- # <link rel="icon" href="/favicon.ico" type="image/x-icon">
432
- set_meta_tags icon: "/favicon.png", type: "image/png"
433
- # <link rel="icon" href="/favicon.png" type="image/png">
505
+ # <link rel="icon" type="image/x-icon" href="/favicon.ico">
506
+ set_meta_tags icon: {href: "/favicon.png", type: "image/png"}
507
+ # <link rel="icon" type="image/png" href="/favicon.png">
434
508
  set_meta_tags icon: [
435
509
  {href: "/images/icons/icon_96.png", sizes: "32x32 96x96", type: "image/png"},
436
510
  {href: "/images/icons/icon_itouch_precomp_32.png", rel: "apple-touch-icon-precomposed", sizes: "32x32", type: "image/png"}
437
511
  ]
438
- # <link rel="icon" href="/images/icons/icon_96.png" type="image/png" sizes="32x32 96x96">
439
- # <link rel="apple-touch-icon-precomposed" href="/images/icons/icon_itouch_precomp_32.png" type="image/png" sizes="32x32">
512
+ # <link rel="icon" type="image/png" href="/images/icons/icon_96.png" sizes="32x32 96x96">
513
+ # <link rel="apple-touch-icon-precomposed" type="image/png" href="/images/icons/icon_itouch_precomp_32.png" sizes="32x32">
440
514
  ```
441
515
 
442
516
  Further reading:
@@ -448,6 +522,8 @@ Further reading:
448
522
 
449
523
  Alternate link elements tell a search engine when there is content that's translated or targeted to users in a certain region.
450
524
 
525
+ <!-- executable-example: alternate -->
526
+
451
527
  ```ruby
452
528
  set_meta_tags alternate: {"fr" => "http://yoursite.fr/alternate/url"}
453
529
  # <link rel="alternate" href="http://yoursite.fr/alternate/url" hreflang="fr">
@@ -478,6 +554,8 @@ Further reading:
478
554
 
479
555
  Previous and next links can describe a paginated sequence for browsers, feed readers, or custom consumers that still read them. Google no longer uses `rel="prev"` and `rel="next"` as an indexing signal, so treat them as optional interoperability metadata, not core SEO guidance.
480
556
 
557
+ <!-- executable-example: pagination -->
558
+
481
559
  ```ruby
482
560
  set_meta_tags prev: "http://yoursite.com/url?page=1"
483
561
  # <link rel="prev" href="http://yoursite.com/url?page=1">
@@ -487,14 +565,15 @@ set_meta_tags next: "http://yoursite.com/url?page=3"
487
565
 
488
566
  Further reading:
489
567
 
490
- - [Pagination](http://support.google.com/webmasters/bin/answer.py?hl=en&answer=1663744)
491
- - [Pagination with rel="next" and rel="prev"](http://googlewebmastercentral.blogspot.ca/2011/09/pagination-with-relnext-and-relprev.html)
568
+ - [Pagination with rel="next" and rel="prev"](https://developers.google.com/search/blog/2011/09/pagination-with-relnext-and-relprev)
492
569
  - [Google Search Central: pagination, incremental page loading, and infinite scroll](https://developers.google.com/search/docs/specialty/ecommerce/pagination-and-incremental-page-loading)
493
570
 
494
571
  ### image_src links
495
572
 
496
573
  `image_src` is a legacy share hint. Modern social sharing generally relies on Open Graph images and platform-specific card tags instead.
497
574
 
575
+ <!-- executable-example: image-src -->
576
+
498
577
  ```ruby
499
578
  set_meta_tags image_src: "http://yoursite.com/icons/icon_32.png"
500
579
  # <link rel="image_src" href="http://yoursite.com/icons/icon_32.png">
@@ -504,8 +583,13 @@ set_meta_tags image_src: "http://yoursite.com/icons/icon_32.png"
504
583
 
505
584
  If your application still serves AMP pages, you can link the AMP version from the canonical page with `amphtml`. This is an optional legacy integration, not a general SEO requirement.
506
585
 
586
+ In a routed Rails view, you can generate the absolute URL with
587
+ `url_for(format: :amp, only_path: false)`.
588
+
589
+ <!-- executable-example: amphtml -->
590
+
507
591
  ```ruby
508
- set_meta_tags amphtml: url_for(format: :amp, only_path: false)
592
+ set_meta_tags amphtml: "https://www.example.com/document.amp"
509
593
  # <link rel="amphtml" href="https://www.example.com/document.amp">
510
594
  ```
511
595
 
@@ -517,6 +601,8 @@ To link back to the normal version, use the `canonical` tag.
517
601
 
518
602
  By including the `rel="manifest"` attribute in the `<link>` element of an HTML page, you can specify the location of the manifest file that describes the web application. This allows the browser to understand that the web page is an application and to provide features like offline access and the ability to add the application to the home screen of a mobile device.
519
603
 
604
+ <!-- executable-example: manifest -->
605
+
520
606
  ```ruby
521
607
  set_meta_tags manifest: "manifest.json"
522
608
  # <link rel="manifest" href="manifest.json">
@@ -528,11 +614,13 @@ set_meta_tags manifest: "manifest.json"
528
614
 
529
615
  Meta refresh is a method of instructing a web browser to automatically refresh the current web page or frame after a given time interval. It is also possible to instruct the browser to fetch a different URL when the page is refreshed, by including the alternative URL in the content parameter. By setting the refresh time interval to zero (or a very low value), this allows meta refresh to be used as a method of URL redirection.
530
616
 
617
+ <!-- executable-example: refresh -->
618
+
531
619
  ```ruby
532
620
  set_meta_tags refresh: 5
533
- # <meta content="5" http-equiv="refresh">
621
+ # <meta http-equiv="refresh" content="5">
534
622
  set_meta_tags refresh: "5;url=http://example.com"
535
- # <meta content="5;url=http://example.com" http-equiv="refresh">
623
+ # <meta http-equiv="refresh" content="5;url=http://example.com">
536
624
  ```
537
625
 
538
626
  Further reading:
@@ -544,23 +632,27 @@ Further reading:
544
632
 
545
633
  Open Search is a link element used to describe a search engine in a standard and accessible format.
546
634
 
635
+ <!-- executable-example: open-search -->
636
+
547
637
  ```ruby
548
638
  set_meta_tags open_search: {
549
639
  title: "Open Search",
550
640
  href: "/opensearch.xml"
551
641
  }
552
- # <link href="/opensearch.xml" rel="search" title="Open Search" type="application/opensearchdescription+xml">
642
+ # <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Open Search">
553
643
  ```
554
644
 
555
645
  Further reading:
556
646
 
557
- - [OpenSearch specs](http://www.opensearch.org/Specifications/OpenSearch/1.1)
647
+ - [OpenSearch specs](https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md)
558
648
  - [OpenSearch wiki](http://en.wikipedia.org/wiki/OpenSearch)
559
649
 
560
650
  ### Hashes
561
651
 
562
652
  Any namespace can be created by simply passing a symbol name and a Hash. For example:
563
653
 
654
+ <!-- executable-example: hashes -->
655
+
564
656
  ```ruby
565
657
  set_meta_tags foo: {
566
658
  bar: "lorem",
@@ -568,14 +660,20 @@ set_meta_tags foo: {
568
660
  qux: "ipsum"
569
661
  }
570
662
  }
571
- # <meta property="foo:bar" content="lorem">
572
- # <meta property="foo:baz:qux" content="ipsum">
663
+ # <meta name="foo:bar" content="lorem">
664
+ # <meta name="foo:baz:qux" content="ipsum">
573
665
  ```
574
666
 
667
+ Arbitrary namespaces use the `name` attribute by default. To render `foo` and
668
+ its colon-delimited children with `property`, add `foo` to
669
+ `MetaTags.config.property_tags` in your initializer.
670
+
575
671
  ### Arrays
576
672
 
577
673
  Repeated meta tags can be easily created by using an Array within a Hash. For example:
578
674
 
675
+ <!-- executable-example: arrays -->
676
+
579
677
  ```ruby
580
678
  set_meta_tags og: {
581
679
  image: ["http://example.com/rock.jpg", "http://example.com/rock2.jpg"]
@@ -588,6 +686,8 @@ set_meta_tags og: {
588
686
 
589
687
  To turn your web pages into graph objects, you'll need to add Open Graph protocol `<meta>` tags to your webpages. The tags allow you to specify structured information about your web pages. The more information you provide, the more opportunities your web pages can be surfaced within Facebook today and in the future. Here's an example for a movie page:
590
688
 
689
+ <!-- executable-example: open-graph -->
690
+
591
691
  ```ruby
592
692
  set_meta_tags og: {
593
693
  title: "The Rock",
@@ -610,11 +710,13 @@ set_meta_tags og: {
610
710
 
611
711
  Multiple images declared as an **array** (look at the `_` character):
612
712
 
713
+ <!-- executable-example: open-graph-images -->
714
+
613
715
  ```ruby
614
716
  set_meta_tags og: {
615
717
  title: "Two structured image properties",
616
718
  type: "website",
617
- url: "view-source:http://examples.opengraphprotocol.us/image-array.html",
719
+ url: "http://examples.opengraphprotocol.us/image-array.html",
618
720
  image: [
619
721
  {
620
722
  _: "http://examples.opengraphprotocol.us/media/images/75.png",
@@ -641,6 +743,8 @@ set_meta_tags og: {
641
743
 
642
744
  Article meta tags are supported too:
643
745
 
746
+ <!-- executable-example: article -->
747
+
644
748
  ```ruby
645
749
  set_meta_tags article: {
646
750
  published_time: "2013-09-17T05:59:00+01:00",
@@ -665,6 +769,8 @@ Further reading:
665
769
 
666
770
  X cards let links shared on X show richer previews. The metadata namespace is still `twitter:*`. Here is a simple summary card example:
667
771
 
772
+ <!-- executable-example: twitter -->
773
+
668
774
  ```ruby
669
775
  set_meta_tags twitter: {
670
776
  card: "summary",
@@ -678,6 +784,8 @@ If you already publish Open Graph tags, you can often keep the X-specific tags m
678
784
 
679
785
  When you need to generate nested `twitter:image:*` tags, the `twitter:image` property is a string while sub-properties can be expressed as a `Hash` in MetaTags:
680
786
 
787
+ <!-- executable-example: twitter-image -->
788
+
681
789
  ```ruby
682
790
  set_meta_tags twitter: {
683
791
  card: "summary_large_image",
@@ -697,6 +805,8 @@ set_meta_tags twitter: {
697
805
 
698
806
  A special parameter `itemprop` can be used on an "anonymous" tag "\_" to generate the "itemprop" HTML attribute:
699
807
 
808
+ <!-- executable-example: twitter-itemprop -->
809
+
700
810
  ```ruby
701
811
  set_meta_tags twitter: {
702
812
  card: "summary_large_image",
@@ -723,6 +833,8 @@ Further reading:
723
833
 
724
834
  App Links is an open cross-platform solution for deep linking to content in your mobile app. Here's an example of iOS app integration:
725
835
 
836
+ <!-- executable-example: app-links -->
837
+
726
838
  ```ruby
727
839
  set_meta_tags al: {
728
840
  ios: {
@@ -746,6 +858,8 @@ Starting from version 1.3.1, you can specify arbitrary meta tags, and they will
746
858
 
747
859
  Example:
748
860
 
861
+ <!-- executable-example: custom-author -->
862
+
749
863
  ```ruby
750
864
  set_meta_tags author: "Dmytro Shteflyuk"
751
865
  # <meta name="author" content="Dmytro Shteflyuk">
@@ -753,6 +867,8 @@ set_meta_tags author: "Dmytro Shteflyuk"
753
867
 
754
868
  You can also specify the value as an Array, and the values will be displayed as a list of `meta` tags:
755
869
 
870
+ <!-- executable-example: custom-author-array -->
871
+
756
872
  ```ruby
757
873
  set_meta_tags author: ["Dmytro Shteflyuk", "John Doe"]
758
874
  # <meta name="author" content="Dmytro Shteflyuk">
data/SECURITY.md ADDED
@@ -0,0 +1,40 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Security fixes are provided for the latest released version of `meta-tags`.
6
+
7
+ Older releases may not receive security updates. If you are reporting a vulnerability, please confirm whether it affects the latest release.
8
+
9
+ ## Reporting a Vulnerability
10
+
11
+ Please do not report security issues through public GitHub issues, discussions, or pull requests.
12
+
13
+ Use GitHub's private vulnerability reporting feature in the repository's `Security` tab to report a vulnerability.
14
+
15
+ If private reporting through GitHub is unavailable for any reason, send a report by email to `kpumuk@kpumuk.info` with `SECURITY` in the subject line.
16
+
17
+ When possible, include:
18
+
19
+ - a short description of the issue
20
+ - the affected version, commit, or tag
21
+ - any required environment or configuration details
22
+ - step-by-step reproduction instructions
23
+ - proof-of-concept code, logs, or screenshots
24
+ - an explanation of the likely impact
25
+
26
+ ## Disclosure Policy
27
+
28
+ Please allow a reasonable amount of time to investigate and prepare a fix before making the issue public.
29
+
30
+ If the report is confirmed, the fix will be released as soon as practical. Public disclosure will generally happen through a GitHub security advisory and/or release notes after a fix is available.
31
+
32
+ ## Scope Notes
33
+
34
+ `meta-tags` is a Ruby gem for Rails applications that renders HTML metadata such as titles, descriptions, canonical links, robots directives, and social tags.
35
+
36
+ Some behavior may depend on the host Rails application, layouts, templates, framework version, gem version, or deployment/runtime configuration. If a report depends on a specific setup, include those details.
37
+
38
+ ## Response Expectations
39
+
40
+ This is a single-maintainer project, so response times may vary. Good-faith reports are appreciated, and I will try to acknowledge valid reports as quickly as practical.
data/certs/kpumuk.pem CHANGED
@@ -1,7 +1,7 @@
1
1
  -----BEGIN CERTIFICATE-----
2
2
  MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MQ8wDQYDVQQDDAZrcHVt
3
3
  dWsxFjAUBgoJkiaJk/IsZAEZFgZrcHVtdWsxFDASBgoJkiaJk/IsZAEZFgRpbmZv
4
- MB4XDTI1MDkyOTE1MDM1M1oXDTI2MDkyOTE1MDM1M1owPzEPMA0GA1UEAwwGa3B1
4
+ MB4XDTI2MTEyODE0MzU1MloXDTI3MTEyODE0MzU1MlowPzEPMA0GA1UEAwwGa3B1
5
5
  bXVrMRYwFAYKCZImiZPyLGQBGRYGa3B1bXVrMRQwEgYKCZImiZPyLGQBGRYEaW5m
6
6
  bzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALw2YroZc+IT+rs8NuPu
7
7
  c13DelrxrpAgPEu1zuRb3l7WaHRNWA4TyS8Z6Aa1G2O+FdUZNMW1n7IwP/QMJ9Mz
@@ -12,10 +12,10 @@ pJ3vGgO2sh5GvJFOPk1Vlur2nX9ZFznPEP1CEAQ+NFrmKRt355Z5sgOkAojSGnIL
12
12
  /1sCAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFPa4
13
13
  VFc1YOlV1u/7EGTwMCAk8YE9MB0GA1UdEQQWMBSBEmtwdW11a0BrcHVtdWsuaW5m
14
14
  bzAdBgNVHRIEFjAUgRJrcHVtdWtAa3B1bXVrLmluZm8wDQYJKoZIhvcNAQELBQAD
15
- ggEBAFz/6+efHFEomTCA8V/eMpzaMkbj04cTmFxm28KiUO1F4vgbSIBx0bsMoJkH
16
- KI956sPVVJMykwOdDUhRWBrHOVTBCGdkYWdb38KQKfwtkdGd8b/Afrxs5GuPME9r
17
- TdfDc1aXCAPdLCajhpmuzfa1g8/W7ORdxwNQidYSSPJ5OvcAGSfxTHJsFseHjrBK
18
- 9hdoXZgqc4a5defxoOZFD9Im9AUwFqwR8njCBST6FbCGmHIYNHj2hxbwrU/1I2Kg
19
- pPzkBOwQl2p1ykAEUe7cwoqJcO+1rPeTHjudNqhOfc3VnMA8A7uXOkTtYNVhvApn
20
- oW4hE/8SnZkQm8jzdi0iX9nWxo8=
15
+ ggEBAGSpWh2R8DV3hZgcukoPFrCVnRAHHYeQz0BhB7c/it2pITgy6F76HFcJLvHg
16
+ OoLg0EeOyc/ClcBN8DCl+ZkHVkqEy6FXiURDQyTprsNbrYfaDcy8kaHJZwhgC9Xq
17
+ Osv/1yVtXOP6L4C42TzrI02zFquFmdKYqsi3KU/dEOiyTS9mktDE3Ha7PLq9lIB8
18
+ 13+QKCjpJUMGlZ1jv8Bi9FkvneDdiH9ACt0T0/q8gh3RW3y0M/4RBD2lIFzbsGns
19
+ yrtanYI2gZSjOVJob8j8cnfTbptGf1KRwp6r6xYNAP4vjY5/6UbcY03lHjluHGqB
20
+ OFHUoH7OjqY3Uh5+KobrRnn9QMY=
21
21
  -----END CERTIFICATE-----
@@ -18,6 +18,11 @@ MetaTags.configure do |config|
18
18
  # a Unicode space (/\p{Space}/).
19
19
  # config.truncate_on_natural_separator = " "
20
20
 
21
+ # When true, arrays passed to `title` and `keywords` stop at item
22
+ # boundaries instead of partially truncating the overflowing item.
23
+ # Single-item arrays are still truncated normally. Default is false.
24
+ # config.truncate_array_items_at_boundaries = false
25
+
21
26
  # Maximum length of the page description. Default is 300.
22
27
  # Set to nil or 0 to remove limits.
23
28
  # config.description_limit = 300
@@ -38,6 +43,11 @@ MetaTags.configure do |config|
38
43
  # Default is false.
39
44
  # config.minify_output = false
40
45
 
46
+ # When true, Symbols inside nested meta tag arrays resolve as references to
47
+ # normalized top-level tags. Default is false until MetaTags 3.0, when this
48
+ # behavior will become the default.
49
+ # config.resolve_symbolic_references_in_arrays = false
50
+
41
51
  # When false, generated meta tags will be self-closing (<meta ... />) instead
42
52
  # of open (`<meta ...>`). Default is true.
43
53
  # config.open_meta_tags = true