page_structured_data 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c876eb5e9c0b0038fdedc9c6d20830d93d329d6694ed708e7129743c530f1495
|
4
|
+
data.tar.gz: eced8b242aa8c2459288de2896df762a40e4da7286bda30b524838c33f5c65f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1e6fb70adc060f12755f37e1148203b6db346ae38d1fa114b6b39566fce0cfa29cd1d55740f650bcee56c33d36f7813aada5d1bc83f044cc85af4d2b6207257
|
7
|
+
data.tar.gz: ed1c65bbbe73bad4e0e0cd6a1dcfdd09be615ad44eaed67ac6beb1f3f03dc953e34ee164cbe1f34452ec891b3c55f8bf0859a106f96df4cc5ece542a7f97279c
|
@@ -25,8 +25,8 @@ module PageStructuredData
|
|
25
25
|
|
26
26
|
def page_title
|
27
27
|
result = title_with_hierarchies.join(separator)
|
28
|
-
if
|
29
|
-
result += separator +
|
28
|
+
if base_app_name.present?
|
29
|
+
result += separator + base_app_name
|
30
30
|
end
|
31
31
|
result
|
32
32
|
end
|
@@ -40,6 +40,14 @@ module PageStructuredData
|
|
40
40
|
|
41
41
|
private
|
42
42
|
|
43
|
+
def base_app_name
|
44
|
+
PageStructuredData.base_app_name
|
45
|
+
end
|
46
|
+
|
47
|
+
def default_image_url
|
48
|
+
PageStructuredData.default_image_url
|
49
|
+
end
|
50
|
+
|
43
51
|
def separator
|
44
52
|
' - '
|
45
53
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PageStructuredData
|
4
|
+
module PageTypes
|
5
|
+
# Basic page metadata for any page
|
6
|
+
class BlogPosting
|
7
|
+
attr_reader :headline, :images, :published_at, :updated_at, :authors
|
8
|
+
|
9
|
+
def initialize(headline:, published_at:, updated_at:, images: [], authors: [])
|
10
|
+
@headline = headline
|
11
|
+
@images = images
|
12
|
+
@published_at = published_at
|
13
|
+
@updated_at = updated_at
|
14
|
+
@authors = authors
|
15
|
+
end
|
16
|
+
|
17
|
+
def json_ld # rubocop:disable Metrics/MethodLength
|
18
|
+
node = {
|
19
|
+
'@context': 'https://schema.org',
|
20
|
+
'@type': 'BlogPosting',
|
21
|
+
}
|
22
|
+
|
23
|
+
node[:headline] = headline
|
24
|
+
node[:image] = images
|
25
|
+
node[:datePublished] = published_at
|
26
|
+
node[:dateModified] = updated_at
|
27
|
+
|
28
|
+
author_hash = authors.map do |author|
|
29
|
+
{
|
30
|
+
'@type': 'Person',
|
31
|
+
name: author[:name],
|
32
|
+
url: author[:url],
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
node[:author] = author_hash
|
37
|
+
|
38
|
+
%(
|
39
|
+
<script type="application/ld+json">
|
40
|
+
#{node.to_json}
|
41
|
+
</script>
|
42
|
+
)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: page_structured_data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jey Geethan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- app/src/page_structured_data/anchors.rb
|
61
61
|
- app/src/page_structured_data/breadcrumbs.rb
|
62
62
|
- app/src/page_structured_data/page.rb
|
63
|
+
- app/src/page_structured_data/page_types/blog_posting.rb
|
63
64
|
- app/src/page_structured_data/page_types/news_article.rb
|
64
65
|
- app/views/layouts/page_structured_data/application.html.erb
|
65
66
|
- app/views/page_structured_data/_meta_tags.html.slim
|