Sha256: 3dd2add4f7f3464990094793eb13eeb96b4175c27c9a02b76f37956762050df1

Contents?: true

Size: 1.14 KB

Versions: 36

Compression:

Stored size: 1.14 KB

Contents

class ApplicationController < ActionController::Base
  before_action :prepare_meta_tags, if: -> { request.get? }
  # CSRF protection is turned on with the protect_from_forgery method. 
  protect_from_forgery unless: -> { request.format.json? }
  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
end

Version data entries

36 entries across 33 versions & 2 rubygems

Version Path
jinda-0.8.0 test/dummy/app/controllers/application_controller.rb
jinda-0.8.0 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda-0.7.7.4 test/dummy/app/controllers/application_controller.rb
jinda-0.7.7.4 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda-0.7.7.3 test/dummy/app/controllers/application_controller.rb
jinda-0.7.7.3 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda-0.7.7.2 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda-0.7.7.1 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda_mind-1.0.0 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda-0.7.7 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda-0.7.6 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda-0.7.5.5 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda-0.7.5.4 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda-0.7.5.3 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda-0.7.5.2 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda-0.7.5.0 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda-0.7.3 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda-0.7.2 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda-0.7.1 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
jinda-0.7.0.4 lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb