seo_sensei 0.0.3 → 0.0.4

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: bdf5d33f3377db508120d4b54461f33a5e53a2355f6136cb787e7d6c55a96fd0
4
- data.tar.gz: 0654f9eae803a1d51cf326b79eee6de79126afb507c2eaeaea6e568de87e3f4f
3
+ metadata.gz: d3c1f469002c62639dd128bfdf533b409a29a4690d6eeaeacf04ac93c1859bde
4
+ data.tar.gz: 44237338d377b31f42267b06df3023bd838c5d3e446e8355e2a0cd4533952607
5
5
  SHA512:
6
- metadata.gz: d56e3bd042fe5ab3bf98136c27de88f825ccfa9aada82fb335fa2e9cdbfe6ccbe540c0041d683a4b2f248aec803fe6a5a4feb31c4fe1c76b9b7b379157dbd706
7
- data.tar.gz: af708903e400b9d597ee5394b5b6fdb9267040289fd953ad8f8a190c19f342ac5b1bf7d2ffbc8d72381faaaa3d449dfef508fb613ae766f864fe1510dda40704
6
+ metadata.gz: c7394e430a8c2a993f3b21c111e27c9738d56dc0f649dec35fac836121c0e86483da595e0d729d9bf84009b97d1b70dc9926d278a33ed088236478391a0037e0
7
+ data.tar.gz: 5fc48288f42702af5713e7d65e51812904fb94ab6bc65d1dde76484a165ba0683a88da24b4dd0089b69fde1891e3c8e7ac186c1edc49395a71e04a2e8d354a8b
data/lib/seo_sensei.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'meta-tags'
4
+ require 'seo_sensei/attributes/twitter'
4
5
  require 'seo_sensei/attributes/og'
5
6
  require 'seo_sensei/attributes/image'
6
7
  require 'seo_sensei/lookup'
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SeoSensei
4
+ module Attributes
5
+ module Twitter
6
+ def self.call(seo_translation, resource, url)
7
+ image_attributes = SeoSensei::Attributes::Image.call(resource)
8
+
9
+ base_attributes = {
10
+ title: seo_translation['title'],
11
+ description: seo_translation['description'],
12
+ url: url
13
+ }
14
+
15
+ unless image_attributes[:image].nil?
16
+ base_attributes.merge!(
17
+ image: image_attributes[:image],
18
+ card: 'summary_large_image'
19
+ )
20
+ end
21
+
22
+ { twitter: base_attributes }
23
+ end
24
+ end
25
+ end
26
+ end
@@ -28,7 +28,11 @@ module SeoSensei
28
28
  translated_seo, resource, url_for(:only_path => false)
29
29
  )
30
30
 
31
- set_meta_tags(translated_seo.merge(og_attributes))
31
+ twitter_attributes = ::SeoSensei::Attributes::Twitter.call(
32
+ translated_seo, resource, url_for(:only_path => false)
33
+ )
34
+
35
+ set_meta_tags(translated_seo.merge(og_attributes, twitter_attributes))
32
36
  end
33
37
  end
34
38
  end
@@ -6,7 +6,7 @@ module SeoSensei
6
6
  #
7
7
  # @return [String]
8
8
  def to_s
9
- "0.0.3"
9
+ "0.0.4"
10
10
  end
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seo_sensei
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paweł Dąbrowski
@@ -85,6 +85,7 @@ files:
85
85
  - lib/seo_sensei.rb
86
86
  - lib/seo_sensei/attributes/image.rb
87
87
  - lib/seo_sensei/attributes/og.rb
88
+ - lib/seo_sensei/attributes/twitter.rb
88
89
  - lib/seo_sensei/controllers/helpers.rb
89
90
  - lib/seo_sensei/lookup.rb
90
91
  - lib/seo_sensei/lookups/database.rb