page_structured_data 1.0.7 → 1.0.9
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 +9 -0
- data/README.md +44 -0
- data/app/src/page_structured_data/page_types/organization.rb +48 -0
- data/lib/page_structured_data/version.rb +1 -1
- data/lib/page_structured_data.rb +7 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 53bab1f6112cc7060c86d1eedc6096770ea5a6363a9d4e9939094f3576a417cf
|
|
4
|
+
data.tar.gz: ecea9e6efd8b44bf45565ec1a790905b55e7794579a91d2b157dec1325ad89c5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fda27db244422de502060211a86f759ca0fe7249a8a370fb7d3f7a89ed2f732181eff65d7c8b19ab48a61cc9be4168dae18c14edb1016d2ba7d97941b343c50b
|
|
7
|
+
data.tar.gz: 78dcbcefc064a3806f41c8f8d83f1943181e05c260501a207cff31ff425f5ad68e2fcf6d436351e4a58ded9c2c4ee12b4768d0f1f27c822951bde8682b4f381d
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@ All notable changes to this project are documented here.
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## 1.0.9 - 2026-05-06
|
|
8
|
+
|
|
9
|
+
- Add release preparation script and release checklist documentation.
|
|
10
|
+
- Add `to_h` schema hash API for organization page types.
|
|
11
|
+
|
|
12
|
+
## 1.0.8 - 2026-05-06
|
|
13
|
+
|
|
14
|
+
- Add `PageStructuredData::PageTypes::Organization` for schema.org Organization JSON-LD.
|
|
15
|
+
|
|
7
16
|
## 1.0.7 - 2026-05-06
|
|
8
17
|
|
|
9
18
|
- Remove unused generated Rails engine boilerplate files.
|
data/README.md
CHANGED
|
@@ -14,6 +14,7 @@ It helps Rails applications render:
|
|
|
14
14
|
- Google-compatible JSON-LD structured data
|
|
15
15
|
- Breadcrumb structured data
|
|
16
16
|
- Article structured data for `BlogPosting` and `NewsArticle`
|
|
17
|
+
- Organization structured data
|
|
17
18
|
|
|
18
19
|
## Requirements
|
|
19
20
|
|
|
@@ -138,6 +139,7 @@ PageStructuredData includes page types for:
|
|
|
138
139
|
|
|
139
140
|
- [`BlogPosting`](https://schema.org/BlogPosting)
|
|
140
141
|
- [`NewsArticle`](https://schema.org/NewsArticle)
|
|
142
|
+
- [`Organization`](https://schema.org/Organization)
|
|
141
143
|
|
|
142
144
|
Use a page type when the current page represents an article:
|
|
143
145
|
|
|
@@ -168,6 +170,27 @@ article_page_type = PageStructuredData::PageTypes::BlogPosting.new(
|
|
|
168
170
|
|
|
169
171
|
For news pages, use `PageStructuredData::PageTypes::NewsArticle` with the same arguments.
|
|
170
172
|
|
|
173
|
+
Use `Organization` when the current page represents an organization:
|
|
174
|
+
|
|
175
|
+
```ruby
|
|
176
|
+
organization_page_type = PageStructuredData::PageTypes::Organization.new(
|
|
177
|
+
name: "RocketApex",
|
|
178
|
+
url: "https://rocketapex.com",
|
|
179
|
+
logo: "https://rocketapex.com/logo.png",
|
|
180
|
+
same_as: ["https://github.com/RocketApex"],
|
|
181
|
+
parent_organization: {
|
|
182
|
+
name: "Parent Org",
|
|
183
|
+
url: "https://parent.example"
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
@page_meta = PageStructuredData::Page.new(
|
|
188
|
+
title: "About RocketApex",
|
|
189
|
+
description: "Open source projects from RocketApex",
|
|
190
|
+
page_type: organization_page_type
|
|
191
|
+
)
|
|
192
|
+
```
|
|
193
|
+
|
|
171
194
|
## API Reference
|
|
172
195
|
|
|
173
196
|
### `PageStructuredData::Page`
|
|
@@ -233,6 +256,25 @@ Important methods:
|
|
|
233
256
|
- `to_h`: returns a structured hash for article JSON-LD.
|
|
234
257
|
- `json_ld`: returns an article JSON-LD script tag.
|
|
235
258
|
|
|
259
|
+
### Organization Page Type
|
|
260
|
+
|
|
261
|
+
```ruby
|
|
262
|
+
PageStructuredData::PageTypes::Organization.new(
|
|
263
|
+
name:,
|
|
264
|
+
url:,
|
|
265
|
+
logo: nil,
|
|
266
|
+
same_as: [],
|
|
267
|
+
parent_organization: nil
|
|
268
|
+
)
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
`parent_organization` should be a hash with `:name` and `:url` keys.
|
|
272
|
+
|
|
273
|
+
Important methods:
|
|
274
|
+
|
|
275
|
+
- `to_h`: returns a structured hash for organization JSON-LD.
|
|
276
|
+
- `json_ld`: returns an organization JSON-LD script tag.
|
|
277
|
+
|
|
236
278
|
## Development
|
|
237
279
|
|
|
238
280
|
Run the test suite:
|
|
@@ -247,6 +289,8 @@ Verify the gem can be required:
|
|
|
247
289
|
ruby -Ilib -e 'require "page_structured_data"; puts PageStructuredData::VERSION'
|
|
248
290
|
```
|
|
249
291
|
|
|
292
|
+
Release instructions are documented in [docs/release.md](docs/release.md).
|
|
293
|
+
|
|
250
294
|
## Compatibility Policy
|
|
251
295
|
|
|
252
296
|
This gem is used in production applications. Changes should preserve existing public APIs and rendered output unless a breaking change is intentionally released in a major version.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PageStructuredData
|
|
4
|
+
module PageTypes
|
|
5
|
+
# Organization structured data for a page
|
|
6
|
+
class Organization
|
|
7
|
+
attr_reader :name, :url, :logo, :same_as, :parent_organization
|
|
8
|
+
|
|
9
|
+
def initialize(name:, url:, logo: nil, same_as: [], parent_organization: nil)
|
|
10
|
+
@name = name
|
|
11
|
+
@url = url
|
|
12
|
+
@logo = logo
|
|
13
|
+
@same_as = same_as
|
|
14
|
+
@parent_organization = parent_organization
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def to_h # rubocop:disable Metrics/MethodLength
|
|
18
|
+
node = {
|
|
19
|
+
'@context': 'https://schema.org',
|
|
20
|
+
'@type': 'Organization',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
node[:name] = name
|
|
24
|
+
node[:url] = url
|
|
25
|
+
node[:logo] = logo if logo.present?
|
|
26
|
+
node[:sameAs] = same_as if same_as.present?
|
|
27
|
+
|
|
28
|
+
if parent_organization.present?
|
|
29
|
+
node[:parentOrganization] = {
|
|
30
|
+
'@type': 'Organization',
|
|
31
|
+
name: parent_organization[:name],
|
|
32
|
+
url: parent_organization[:url],
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
node
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def json_ld
|
|
40
|
+
%(
|
|
41
|
+
<script type="application/ld+json">
|
|
42
|
+
#{to_h.to_json}
|
|
43
|
+
</script>
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
data/lib/page_structured_data.rb
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
require "page_structured_data/version"
|
|
2
2
|
require "page_structured_data/engine"
|
|
3
|
+
require_relative "../app/src/page_structured_data/anchors"
|
|
4
|
+
require_relative "../app/src/page_structured_data/breadcrumbs"
|
|
5
|
+
require_relative "../app/src/page_structured_data/page_types/article"
|
|
6
|
+
require_relative "../app/src/page_structured_data/page_types/blog_posting"
|
|
7
|
+
require_relative "../app/src/page_structured_data/page_types/news_article"
|
|
8
|
+
require_relative "../app/src/page_structured_data/page_types/organization"
|
|
9
|
+
require_relative "../app/src/page_structured_data/page"
|
|
3
10
|
|
|
4
11
|
module PageStructuredData
|
|
5
12
|
class << self
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: page_structured_data
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jey Geethan
|
|
@@ -49,6 +49,7 @@ files:
|
|
|
49
49
|
- app/src/page_structured_data/page_types/article.rb
|
|
50
50
|
- app/src/page_structured_data/page_types/blog_posting.rb
|
|
51
51
|
- app/src/page_structured_data/page_types/news_article.rb
|
|
52
|
+
- app/src/page_structured_data/page_types/organization.rb
|
|
52
53
|
- app/views/page_structured_data/_meta_tags.html.erb
|
|
53
54
|
- config/routes.rb
|
|
54
55
|
- lib/page_structured_data.rb
|