seorel 0.4.0 → 0.5.0

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
- SHA1:
3
- metadata.gz: 1c479f1d7dfaa791665b2a20d1a5ef1c2baa7f63
4
- data.tar.gz: 2380c00e8e501060c1d35f989032d55e3bd6d381
2
+ SHA256:
3
+ metadata.gz: d759c42f88685fee36ec92f71b4e66b6e300711ea81625cb62336841ae894034
4
+ data.tar.gz: c801be56ff1030399f2c9668a2d5aac7aa020994118806f5a6bc207b9611ac94
5
5
  SHA512:
6
- metadata.gz: f4dbcdcfb0364e06169211ca40126399386aba10ad4b873d8d9eacf781a1d3c11c64a23ee20116afe81200bd2c4bbc130f92b4a055a08fa7c212b93e8ce1ca82
7
- data.tar.gz: d4aee49ecda37866939270ad873c169f44c94eeebfabe20abbf97614d5f4b5856f5a42b22f6a21d17183a91d3be53c3f2145611724e11b18bbe84fb56ed13133
6
+ metadata.gz: 8c5f3cffb7628a4ade2fe21d9e8a446570abfdb94e3b11d64602561311c486436bf4442a7445947b7066335c0664ffae698f1c75d95175aa8577468c78723f49
7
+ data.tar.gz: 96acf62ddb04748ba35636ec064dfb27e2073d184d4fc2483d2c2fa3ebfebd706af7f628d6b1fff5ac43ec003930df1be0b8449679c06511ba18ad05ac2bb68e
data/README.md CHANGED
@@ -12,7 +12,7 @@ Ruby on Rails SEO Metatags plugins for ActiveRecord models
12
12
  `Gemfile.rb`:
13
13
 
14
14
  ```ruby
15
- gem 'seorel', '~> 0.3.0'
15
+ gem 'seorel', '~> 0.5.0'
16
16
 
17
17
  # the edge version can be had using:
18
18
  # gem 'seorel', github: 'dalpo/seorel'
@@ -54,6 +54,10 @@ Seorel.configure do |config|
54
54
  config.default_twitter_metas = {
55
55
  card: 'summary_large_image'
56
56
  }
57
+
58
+ # config.enable_pagination = true
59
+ # config.pagination_format = ' - Pag. %page%'
60
+ # config.pagination_parameter_name = 'page'
57
61
  end
58
62
  ```
59
63
 
@@ -18,6 +18,10 @@ module Seorel
18
18
  config_accessor :store_seorel_if
19
19
  config_accessor :default_og_metas
20
20
  config_accessor :default_twitter_metas
21
+ config_accessor :enable_pagination
22
+ config_accessor :pagination_format
23
+ config_accessor :pagination_parameter_name
24
+
21
25
 
22
26
  def param_name
23
27
  config.param_name.respond_to?(:call) ? config.param_name.call : config.param_name
@@ -41,6 +45,9 @@ module Seorel
41
45
  self.store_seorel_if = :empty
42
46
  self.default_og_metas = {}
43
47
  self.default_twitter_metas = {}
48
+ self.enable_pagination = false
49
+ self.pagination_format = ' - Pag. %page%'
50
+ self.pagination_parameter_name = 'page'
44
51
  end
45
52
  end
46
53
 
@@ -16,10 +16,17 @@ module Seorel
16
16
  @controller = controller
17
17
  end
18
18
 
19
+ def page_text
20
+ return unless available_pagination?
21
+
22
+ default_options.pagination_format.gsub('%page%', pagination_page)
23
+ end
24
+
19
25
  def title
20
26
  [
21
27
  lookup_prepend_title,
22
28
  base_title,
29
+ page_text,
23
30
  lookup_append_title
24
31
  ].compact.join.html_safe
25
32
  end
@@ -28,6 +35,7 @@ module Seorel
28
35
  [
29
36
  lookup_prepend_description,
30
37
  base_description,
38
+ page_text,
31
39
  lookup_append_description
32
40
  ].compact.join.html_safe
33
41
  end
@@ -52,6 +60,17 @@ module Seorel
52
60
 
53
61
  attr_reader :controller
54
62
 
63
+ delegate :params, to: :controller, allow_nil: true
64
+
65
+ def pagination_page
66
+ return unless controller
67
+ params.try(:[], default_options.pagination_parameter_name.to_s)
68
+ end
69
+
70
+ def available_pagination?
71
+ default_options.enable_pagination && pagination_page
72
+ end
73
+
55
74
  def base_title
56
75
  (config.title || lookup_title).html_safe
57
76
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Seorel
4
- VERSION = '0.4.0'.freeze
4
+ VERSION = '0.5.0'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seorel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrea Dal Ponte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-28 00:00:00.000000000 Z
11
+ date: 2018-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  requirements: []
153
153
  rubyforge_project:
154
- rubygems_version: 2.6.13
154
+ rubygems_version: 2.7.6
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Ruby on Rails SEO Metatags engine for ActiveRecord models