effective_pages 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/effective_pages_helper.rb +37 -5
- data/config/effective_pages.rb +2 -0
- data/lib/effective_pages.rb +3 -0
- data/lib/effective_pages/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc498e340a48fc55a8059cc7bbaa980aaaaac603
|
4
|
+
data.tar.gz: a5a2b5379909e0228fe9a8afe5841ee289c255da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da616415ef99d0c6cbdce36651628c36c76a05f131f5de724488ad40320f795cda2fa9e5658340feec1f87a3ecbbf48b0d0bedebd28fde0a1e4b7b75e5cb9823
|
7
|
+
data.tar.gz: 56bbbb4deb9e1bb2175c166bd37cb0b59c8d096d8313792ca7a0eb68464a9052044ee120433ea25084607826c3ba2c30c7cf54797a7cc3a2b23ca803ef719a4f
|
@@ -11,15 +11,43 @@ module EffectivePagesHelper
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def effective_pages_header_tags
|
14
|
-
[
|
14
|
+
tags = [
|
15
15
|
content_tag(:title, effective_pages_site_title),
|
16
|
-
tag(:meta, name: 'description'
|
16
|
+
tag(:meta, name: 'description', content: effective_pages_meta_description),
|
17
17
|
tag(:meta, property: 'og:site_name', content: EffectivePages.site_title.to_s),
|
18
18
|
tag(:meta, property: 'og:title', content: effective_pages_page_title),
|
19
|
-
tag(:meta, property: 'og:description', content: effective_pages_meta_description),
|
20
19
|
tag(:meta, property: 'og:url', content: request.original_url),
|
21
|
-
tag(:meta, property: 'og:
|
22
|
-
|
20
|
+
tag(:meta, property: 'og:type', content: effective_pages_og_type),
|
21
|
+
tag(:meta, property: 'og:description', content: effective_pages_meta_description),
|
22
|
+
tag(:meta, itemprop: 'name', content: effective_pages_page_title),
|
23
|
+
tag(:meta, itemprop: 'url', content: request.original_url),
|
24
|
+
tag(:meta, itemprop: 'description', content: effective_pages_meta_description),
|
25
|
+
tag(:meta, name: 'twitter:title', content: effective_pages_page_title),
|
26
|
+
tag(:meta, name: 'twitter:url', content: request.original_url),
|
27
|
+
tag(:meta, name: 'twitter:card', content: 'summary'),
|
28
|
+
tag(:meta, name: 'twitter:description', content: effective_pages_meta_description),
|
29
|
+
]
|
30
|
+
|
31
|
+
if EffectivePages.site_og_image.present?
|
32
|
+
image_url = asset_url(EffectivePages.site_og_image)
|
33
|
+
|
34
|
+
tags += [
|
35
|
+
tag(:meta, property: 'og:image', content: image_url),
|
36
|
+
tag(:meta, itemprop: 'thumbnailUrl', content: image_url),
|
37
|
+
tag(:meta, itemprop: 'image', content: image_url),
|
38
|
+
tag(:meta, name: 'twitter:image', content: image_url),
|
39
|
+
]
|
40
|
+
|
41
|
+
if EffectivePages.site_og_image_width.present?
|
42
|
+
tags << tag(:meta, property: 'og:image:width', content: EffectivePages.site_og_image_width)
|
43
|
+
end
|
44
|
+
|
45
|
+
if EffectivePages.site_og_image_height.present?
|
46
|
+
tags << tag(:meta, property: 'og:image:height', content: EffectivePages.site_og_image_height)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
tags.compact.join("\n").html_safe
|
23
51
|
end
|
24
52
|
|
25
53
|
def effective_pages_page_title
|
@@ -42,6 +70,10 @@ module EffectivePagesHelper
|
|
42
70
|
truncate((@meta_description || EffectivePages.fallback_meta_description).to_s, length: 150)
|
43
71
|
end
|
44
72
|
|
73
|
+
def effective_pages_og_type
|
74
|
+
@effective_pages_og_type || 'website'
|
75
|
+
end
|
76
|
+
|
45
77
|
def application_root_to_effective_pages_slug
|
46
78
|
Rails.application.routes.routes.find { |r| r.name == 'root' && r.defaults[:controller] == 'Effective::Pages' && r.defaults[:action] == 'show' }.defaults[:id] rescue nil
|
47
79
|
end
|
data/config/effective_pages.rb
CHANGED
@@ -25,6 +25,8 @@ EffectivePages.setup do |config|
|
|
25
25
|
|
26
26
|
# This site_og_image is the filename for an image placed in /assets/images and will be used to populate the og:image tag
|
27
27
|
config.site_og_image = ''
|
28
|
+
config.site_og_image_width = '' # Just 1024, no units
|
29
|
+
config.site_og_image_height = ''
|
28
30
|
|
29
31
|
# When using the effective_pages_header_tags() helper in <head> to set the <meta name='description'>
|
30
32
|
# The value will be populated from an Effective::Page's .meta_description field,
|
data/lib/effective_pages.rb
CHANGED
@@ -14,6 +14,9 @@ module EffectivePages
|
|
14
14
|
mattr_accessor :excluded_layouts
|
15
15
|
|
16
16
|
mattr_accessor :site_og_image
|
17
|
+
mattr_accessor :site_og_image_width
|
18
|
+
mattr_accessor :site_og_image_height
|
19
|
+
|
17
20
|
mattr_accessor :site_title
|
18
21
|
mattr_accessor :site_title_suffix
|
19
22
|
mattr_accessor :fallback_meta_description
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|