opengraphplus 0.1.14 → 0.1.15
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 36436838c92a8e927fccd2f81c56cdaa0c77685b763ae7a942c3ebfdbd3740cf
|
|
4
|
+
data.tar.gz: 3bc5a59c5d6f787effcec54b7727761d999ea04786a9dcf6506d1686f99368e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cb42ce974d15655f9320209a5f8ac669c0cc96624c9dd0b515a739f9de00ff10576e430a0e44f1b9d56b1e340ccc30cefbd9b318a09d9948d1ead093059ebb0c
|
|
7
|
+
data.tar.gz: 6fb376cccc4f2d52f5659aee2a5c31d26b840f219ebaa8eb270a3c8f8246cb1f11dc03857943b19729ce00fe377b4eb1af9c5c62fe0f4728b3045a7131f7001e
|
|
@@ -17,9 +17,19 @@ module Opengraphplus
|
|
|
17
17
|
inject_into_class "app/controllers/application_controller.rb", "ApplicationController", <<-RUBY
|
|
18
18
|
|
|
19
19
|
open_graph do |og|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
og.site_name =
|
|
20
|
+
# Change to the name of your website. Required for Open Graph
|
|
21
|
+
# consumers like Twitter.
|
|
22
|
+
og.site_name = "My Website"
|
|
23
|
+
|
|
24
|
+
if Rails.env.production?
|
|
25
|
+
# Most Rails sites don't use cache headers, so we set a default
|
|
26
|
+
# max_age in the meta tags to avoid excessive preview image rendering.
|
|
27
|
+
#
|
|
28
|
+
# If you do manage HTTP cache headers in your Rails application, you
|
|
29
|
+
# can delete this tag and/or set this in controllers that don't have
|
|
30
|
+
# caching set.
|
|
31
|
+
og.plus.cache.max_age = 10.minutes
|
|
32
|
+
end
|
|
23
33
|
end
|
|
24
34
|
RUBY
|
|
25
35
|
end
|
|
@@ -53,6 +53,17 @@ module OpenGraphPlus
|
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
class Cache < Base
|
|
57
|
+
attr_accessor :max_age, :etag
|
|
58
|
+
|
|
59
|
+
def tags
|
|
60
|
+
[
|
|
61
|
+
tag("og:plus:cache:max_age", max_age),
|
|
62
|
+
tag("og:plus:cache:etag", etag)
|
|
63
|
+
].compact
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
56
67
|
class Plus < Base
|
|
57
68
|
attr_accessor :selector, :style
|
|
58
69
|
|
|
@@ -69,11 +80,16 @@ module OpenGraphPlus
|
|
|
69
80
|
@viewport ||= Viewport.new
|
|
70
81
|
end
|
|
71
82
|
|
|
83
|
+
def cache
|
|
84
|
+
@cache ||= Cache.new
|
|
85
|
+
end
|
|
86
|
+
|
|
72
87
|
def tags
|
|
73
88
|
[
|
|
74
89
|
tag("og:plus:selector", selector),
|
|
75
90
|
tag("og:plus:style", style),
|
|
76
|
-
*viewport.tags
|
|
91
|
+
*viewport.tags,
|
|
92
|
+
*cache.tags
|
|
77
93
|
].compact
|
|
78
94
|
end
|
|
79
95
|
|
|
@@ -18,7 +18,7 @@ module OpenGraphPlus
|
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def open_graph_plus_image_url(source_url = request.
|
|
21
|
+
def open_graph_plus_image_url(source_url = request.url)
|
|
22
22
|
OpenGraphPlus.image_url(source_url)
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -26,7 +26,7 @@ module OpenGraphPlus
|
|
|
26
26
|
|
|
27
27
|
def set_default_open_graph
|
|
28
28
|
open_graph.type = "website"
|
|
29
|
-
open_graph.url = request.
|
|
29
|
+
open_graph.url = request.url
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def set_default_open_graph_image
|
|
@@ -4,7 +4,7 @@ module OpenGraphPlus
|
|
|
4
4
|
module Rails
|
|
5
5
|
module Helper
|
|
6
6
|
def open_graph(**)
|
|
7
|
-
@open_graph_root ||=
|
|
7
|
+
@open_graph_root ||= default_open_graph
|
|
8
8
|
@open_graph_root.update(**)
|
|
9
9
|
yield @open_graph_root if block_given?
|
|
10
10
|
@open_graph_root
|
|
@@ -15,9 +15,17 @@ module OpenGraphPlus
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def open_graph_meta_tags
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
yield open_graph if block_given?
|
|
19
|
+
open_graph.render_in(self)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
protected
|
|
23
|
+
|
|
24
|
+
def default_open_graph
|
|
25
|
+
Namespace::Root.new.tap do |root|
|
|
26
|
+
root.type = "website"
|
|
27
|
+
root.url = request.url if request
|
|
28
|
+
end
|
|
21
29
|
end
|
|
22
30
|
end
|
|
23
31
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opengraphplus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.15
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brad Gessler
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-01-
|
|
10
|
+
date: 2026-01-23 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activesupport
|