contemble 0.1.3 → 0.1.4
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/README.md +21 -0
- data/lib/contemble/client.rb +4 -0
- data/lib/contemble/resources.rb +10 -0
- data/lib/contemble/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d24648e5804b56f09d868bc242a5111a94e1d933105c358f3ed97663e1c1a954
|
|
4
|
+
data.tar.gz: 82a446c690a080657b2fb3c82e9bac37bb84aa1313c437eebb912bf7e82e3d61
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c4332db2ccc94acda3db69fcf3819db356639fa5e49217e396a952045ece72f00a40483c084c2b0bba022bedf2a88b4b32676c51c015c68b4dacea2bc8f5388
|
|
7
|
+
data.tar.gz: 325fdc43ec857e1f5778d4e3868e0f07a20d5f231b8c1d3e5bd2e2de9f38ab9828a1a8a2529c0acb54d79617dd46d47354f86fc5dadd1976c21e32d675c39c2c
|
data/README.md
CHANGED
|
@@ -42,6 +42,9 @@ post = client.posts.show(slug: "post-slug")
|
|
|
42
42
|
|
|
43
43
|
# Get sitemap XML
|
|
44
44
|
sitemap_xml = client.sitemap.xml
|
|
45
|
+
|
|
46
|
+
# Get article schema
|
|
47
|
+
article_schema = client.schema.article(slug: "post-slug")
|
|
45
48
|
```
|
|
46
49
|
|
|
47
50
|
### Available Data
|
|
@@ -87,6 +90,24 @@ end
|
|
|
87
90
|
|
|
88
91
|
The sitemap URLs will use your configured base URL from your Contemble team settings. For large teams with many posts, this will automatically return a sitemap index that references multiple sitemap files.
|
|
89
92
|
|
|
93
|
+
### Schema Usage
|
|
94
|
+
|
|
95
|
+
```ruby
|
|
96
|
+
client = Contemble::Client.new(api_key: "your_api_key")
|
|
97
|
+
|
|
98
|
+
# Get JSON-LD schema for a specific article
|
|
99
|
+
schema = client.schema.article(slug: "my-post")
|
|
100
|
+
|
|
101
|
+
# Use in your Rails template
|
|
102
|
+
content_for :head do
|
|
103
|
+
content_tag :script, type: "application/ld+json" do
|
|
104
|
+
raw schema.to_json
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Article Schema** returns JSON-LD structured data including headline, description, dates, images, and publisher information for SEO rich snippets.
|
|
110
|
+
|
|
90
111
|
## License
|
|
91
112
|
|
|
92
113
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/contemble/client.rb
CHANGED
|
@@ -25,6 +25,10 @@ module Contemble
|
|
|
25
25
|
@sitemap ||= Resources::Sitemap.new(self)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
def schema
|
|
29
|
+
@schema ||= Resources::Schema.new(self)
|
|
30
|
+
end
|
|
31
|
+
|
|
28
32
|
def get(path, params = {})
|
|
29
33
|
uri = URI("#{@base_url}#{path}")
|
|
30
34
|
uri.query = URI.encode_www_form(params) unless params.empty?
|
data/lib/contemble/resources.rb
CHANGED
data/lib/contemble/version.rb
CHANGED