effective_pages 2.0.5 → 2.0.6

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: 64d6ac4c034e7b55034c50c15f907f937110daa117af3bb2579547fd1da3a4c3
4
- data.tar.gz: 61b61f6a912e821e77c07298723f8864c4fc6669e4f5719f8a6c98190bd4164b
3
+ metadata.gz: 398c1e27018e91e6b525023eb4436e1996e5d6bf27a709b6ffcfb28f2a1244aa
4
+ data.tar.gz: ba5550d8d643d97c3bc28b16150332d5a6a82b030e021044dc69b5e4639992ed
5
5
  SHA512:
6
- metadata.gz: 4b5eb44075781cf1a5790e7e5cf7b24af4ed58fb849e4270c5be20c3a51069ccea30ff0327c29aa0f6464f0282cd53b79d2568499627511cdb19b0fefe737e54
7
- data.tar.gz: 0ad912da27c0cb8b7b3c625fd9e1d90025290fa987b3db6a4f1385d843972d1fa8a59287d4061ddd21ef441a94ca81634764d9125084520d9d351f18ec8f6d13
6
+ metadata.gz: c071da921b8873e0160aacc25344307f0e592900216b43f2aa523fb5debd6b200c6c14f1a753351bfed8d772aa7f808aeed66ad58d68e83ab72a1c7a82747c78
7
+ data.tar.gz: 7824e33d15accde33a03b86d8066ae965925f12222d9f6076a55e147929fc7c718314ddd80179d1ae4c130bacc57cac9e954be441a82a82710d7348e2a866948
@@ -13,6 +13,7 @@ module Effective
13
13
 
14
14
  @page_title = @page.title
15
15
  @meta_description = @page.meta_description
16
+ @canonical_url = effective_pages.page_url(@page)
16
17
 
17
18
  if EffectivePages.authorized?(self, :admin, :effective_pages)
18
19
  flash.now[:warning] = [
@@ -39,14 +39,18 @@ module EffectivePagesHelper
39
39
  ]
40
40
 
41
41
  if EffectivePages.site_og_image_width.present?
42
- tags << tag(:meta, property: 'og:image:width', content: EffectivePages.site_og_image_width)
42
+ tags << tag(:meta, property: 'og:image:width', content: EffectivePages.site_og_image_width)
43
43
  end
44
44
 
45
45
  if EffectivePages.site_og_image_height.present?
46
- tags << tag(:meta, property: 'og:image:height', content: EffectivePages.site_og_image_height)
46
+ tags << tag(:meta, property: 'og:image:height', content: EffectivePages.site_og_image_height)
47
47
  end
48
48
  end
49
49
 
50
+ if effective_pages_canonical_url.present?
51
+ tags << tag(:link, rel: 'canonical', href: effective_pages_canonical_url)
52
+ end
53
+
50
54
  tags.compact.join("\n").html_safe
51
55
  end
52
56
 
@@ -70,6 +74,14 @@ module EffectivePagesHelper
70
74
  truncate((@meta_description || EffectivePages.fallback_meta_description).to_s, length: 150)
71
75
  end
72
76
 
77
+ def effective_pages_canonical_url
78
+ unless @canonical_url.present? || EffectivePages.silence_missing_canonical_url_warnings
79
+ Rails.logger.error("WARNING: (effective_pages) Expected @canonical_url to be present. Please assign a @canonical_url variable in your controller action.")
80
+ end
81
+
82
+ @canonical_url
83
+ end
84
+
73
85
  def effective_pages_og_type
74
86
  @effective_pages_og_type || 'website'
75
87
  end
@@ -37,6 +37,8 @@ EffectivePages.setup do |config|
37
37
  # Turn off missing meta page title and meta description warnings
38
38
  config.silence_missing_page_title_warnings = false
39
39
  config.silence_missing_meta_description_warnings = false
40
+ config.silence_missing_canonical_url_warnings = false
41
+
40
42
 
41
43
  # Display the effective roles 'choose roles' input when an admin creates a new post
42
44
  config.use_effective_roles = false
@@ -1,3 +1,3 @@
1
1
  module EffectivePages
2
- VERSION = '2.0.5'.freeze
2
+ VERSION = '2.0.6'.freeze
3
3
  end
@@ -23,7 +23,8 @@ module EffectivePages
23
23
 
24
24
  mattr_accessor :silence_missing_page_title_warnings
25
25
  mattr_accessor :silence_missing_meta_description_warnings
26
-
26
+ mattr_accessor :silence_missing_canonical_url_warnings
27
+
27
28
  mattr_accessor :use_effective_roles
28
29
 
29
30
  mattr_accessor :menu
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.5
4
+ version: 2.0.6
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: 2019-06-03 00:00:00.000000000 Z
11
+ date: 2019-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails