effective_pages 1.1.2 → 1.1.3

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
  SHA1:
3
- metadata.gz: cb3150222d696ba34d6730dbb508ad3c275576c5
4
- data.tar.gz: 53ff53ecdd6b9509730bb2d39caed59c14ec1f7e
3
+ metadata.gz: 587508cec2b677dd7fe58c72c21959f0d197c1c9
4
+ data.tar.gz: f74c3e83c9185298f302b32ca4425e2a8d3c0dc8
5
5
  SHA512:
6
- metadata.gz: cefaab3e63906996e5d16307d656711d8cf7249a934026588d071abcd7a44f81c481ab999de76ee1b39705d5610af0677746f2a3160946962e5890453d0e385b
7
- data.tar.gz: 1499a98f2c42d5eed1201e28efdd30e0531a6d0e3a62caae6c7833942dc11bcfd5ef3d9ded26a4fc769740fee58cef5f5d193381a9c5f955a4b28c69c241a4bd
6
+ metadata.gz: 89d3bd9324ee7858b41016218c9150de0ef47d24e9a993e6e646173d2b50f8c436a0cac489aeca640b31e4626c8814ff3adc14cba7104dd59a5faa9f19457e4c
7
+ data.tar.gz: 9c13ffda03b844cab226b6b8f40829e491d35065534b5691f2f71f7d516fd980e6832a242f9d53101531228d03e95ce45e134bede7592d1a29fe712e2b75fa7f
data/README.md CHANGED
@@ -47,13 +47,13 @@ Then migrate the database:
47
47
  rake db:migrate
48
48
  ```
49
49
 
50
- Add the following helper to your application layout in the `<head>..</head>` section. This will properly create `<title>` and `<meta description>` tags based on the Effective::Page and the controller instance variables `@page_title` and `@meta_description` for non Effective::Page routes.
50
+ Add the following helper to your application layout in the `<head>..</head>` section. This will properly create `<title>` and `<meta description>` tags based on the Effective::Page and the controller instance variables `@page_title` and `@meta_description` for non Effective::Page routes. It will also create additional Open Graph tags based on the initializer.
51
51
 
52
52
  ```ruby
53
53
  = effective_pages_header_tags
54
54
  ```
55
55
 
56
- There are no required javascript or stylesheet includes.
56
+ There are no required javascript or stylesheet includes, but you will want to ensure there is an Open Graph compatible image available in your assets folder.
57
57
 
58
58
 
59
59
  ### Post Installation
@@ -13,16 +13,25 @@ module EffectivePagesHelper
13
13
  def effective_pages_header_tags
14
14
  [
15
15
  content_tag(:title, effective_pages_site_title),
16
- tag(:meta, name: 'description'.freeze, content: effective_pages_meta_description)
16
+ tag(:meta, name: 'description'.freeze, content: effective_pages_meta_description),
17
+ tag(:meta, property: 'og:site_name', content: EffectivePages.site_title.to_s),
18
+ tag(:meta, property: 'og:title', content: effective_pages_page_title),
19
+ tag(:meta, property: 'og:description', content: effective_pages_meta_description),
20
+ tag(:meta, property: 'og:url', content: request.original_url),
21
+ tag(:meta, property: 'og:image', content: asset_path(EffectivePages.site_og_image.to_s))
17
22
  ].compact.join("\n").html_safe
18
23
  end
19
24
 
20
- def effective_pages_site_title
25
+ def effective_pages_page_title
21
26
  unless @page_title.present? || EffectivePages.silence_missing_page_title_warnings
22
27
  Rails.logger.error("WARNING: (effective_pages) Expected @page_title to be present. Please assign a @page_title variable in your controller action.")
23
28
  end
24
29
 
25
- (@page_title || "#{params[:controller].try(:titleize)} #{params[:action].try(:titleize)}") + EffectivePages.site_title_suffix.to_s
30
+ (@page_title || "#{params[:controller].try(:titleize)} #{params[:action].try(:titleize)}")
31
+ end
32
+
33
+ def effective_pages_site_title
34
+ effective_pages_page_title + EffectivePages.site_title_suffix.to_s
26
35
  end
27
36
 
28
37
  def effective_pages_meta_description
@@ -17,9 +17,15 @@ EffectivePages.setup do |config|
17
17
  # Any app/views/layouts/ layout files that should be excluded
18
18
  config.excluded_layouts = [:admin]
19
19
 
20
- # This string will be appended to the effective_pages_header_tags title tag
20
+ # The site_title will be used to populate the og:site_name tag
21
+ config.site_title = "#{Rails.application.class.name.split('::').first.titleize}"
22
+
23
+ # The site_title_suffix will be appended to the effective_pages_header_tags title tag
21
24
  config.site_title_suffix = " | #{Rails.application.class.name.split('::').first.titleize}"
22
25
 
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
+ config.site_og_image = ''
28
+
23
29
  # When using the effective_pages_header_tags() helper in <head> to set the <meta name='description'>
24
30
  # The value will be populated from an Effective::Page's .meta_description field,
25
31
  # a present @meta_description controller instance variable or this fallback value.
@@ -1,3 +1,3 @@
1
1
  module EffectivePages
2
- VERSION = '1.1.2'.freeze
2
+ VERSION = '1.1.3'.freeze
3
3
  end
@@ -15,6 +15,8 @@ module EffectivePages
15
15
  mattr_accessor :excluded_pages
16
16
  mattr_accessor :excluded_layouts
17
17
 
18
+ mattr_accessor :site_og_image
19
+ mattr_accessor :site_title
18
20
  mattr_accessor :site_title_suffix
19
21
  mattr_accessor :fallback_meta_description
20
22
 
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: 1.1.2
4
+ version: 1.1.3
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: 2017-02-03 00:00:00.000000000 Z
11
+ date: 2017-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails