Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#prepare_meta_tags(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb', line 5

def prepare_meta_tags(options={})
  site_name   = DEFAULT_TITLE
  title       = [controller_name, action_name].join(" ")
  description = DEFAULT_DESCRIPTION
  image       = options[:image] || href="/assets/images/logo.png"
  keywords     = DEFAULT_KEYWORDS
  current_url = request.url

  # Let's prepare a nice set of defaults
  defaults = {
    site:        site_name,
    title:       title,
    image:       image,
    description: description,
    keywords:    keywords,
    twitter: {
      site_name: site_name,
      site: site_name,
      card: 'summary',
      description: description,
      image: image
    },
    og: {
      url: current_url,
      site_name: site_name,
      title: title,
      image: image,
      description: description,
      type: 'website'
    }
  }

  options.reverse_merge!(defaults)

  set_meta_tags options
end