Sha256: 101bfe1b9dfe1d977e678cfce15c2a1dabcc4bc657bc9a2a56981af7e79ecfe9

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

module Seoable
  extend ActiveSupport::Concern
  if RocketCMS.mongoid?
    include ::Mongoid::Paperclip
  end
  
  included do
    if RocketCMS.mongoid?
      field :name, type: String, localize: RocketCMS.configuration.localize
      field :h1, type: String, localize: RocketCMS.configuration.localize

      field :title, type: String, localize: RocketCMS.configuration.localize
      field :keywords, type: String, localize: RocketCMS.configuration.localize
      field :description, type: String, localize: RocketCMS.configuration.localize
      field :robots, type: String, localize: RocketCMS.configuration.localize

      field :og_title, type: String, localize: RocketCMS.configuration.localize
      has_mongoid_attached_file :og_image, styles: {thumb: "800x600>"}
    elsif RocketCMS.active_record?
      has_attached_file :og_image, styles: {thumb: "800x600>"}
    end
    validates_attachment_content_type :og_image, content_type: %w(image/gif image/jpeg image/jpg image/png), if: :image?
  end

  def page_title
    title.blank? ? name : title
  end

  def get_og_title
    og_title.blank? ? name : og_title
  end
  
  def self.admin
    RocketCMS.seo_config
  end
  
  # deprecated
  def self.seo_config
    RocketCMS.seo_config
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rocket_cms-0.5.0 app/models/concerns/seoable.rb