active_seo 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f3c5f0485f54669be9f324e66296eb6904df1d03
4
+ data.tar.gz: 1510d222a6c6a513a9ba40657fbcc04fc631419d
5
+ SHA512:
6
+ metadata.gz: 1fce9cc9475392a7b63d4f11cc6a8c9dc89eb60f08a9509abed2963a10fea605d1fe758288725ab81006b9232fe3cd6bb10bf843df1e59bbab6be573e5562571
7
+ data.tar.gz: ffbf3b53241f6badab3475b2b6394b085c240bcf9d66984dc1b0f0aa281e51002cc0aa25f63c8eaf9e781b56d582951c144bee8a4cbb7344e09e66122c9b0e6b
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at olibia@hardpixel.eu. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in active_seo.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Olibia Tsati
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,185 @@
1
+ # ActiveSeo
2
+
3
+ Optimize ActiveRecord models with support for SEO, Twitter and Open Graph meta.
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/active_seo.svg)](https://badge.fury.io/rb/active_seo)
6
+ [![Build Status](https://travis-ci.org/hardpixel/active-seo.svg?branch=master)](https://travis-ci.org/hardpixel/active-seo)
7
+ [![Maintainability](https://api.codeclimate.com/v1/badges/4447eb1a073a93ace5b2/maintainability)](https://codeclimate.com/github/hardpixel/active-seo/maintainability)
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```console
14
+ gem 'active_seo'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ ```console
20
+ $ bundle
21
+ ```
22
+
23
+ Or install it yourself as:
24
+
25
+ ```console
26
+ $ gem install active_seo
27
+ ```
28
+
29
+ Then run the generator that will create a migration for the SeoMetum model and an initializer:
30
+
31
+ ```console
32
+ $ rails g active_seo:install
33
+ ```
34
+
35
+ And finally run the migrations:
36
+
37
+ ```console
38
+ $ rails db:migrate
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ To add SEO meta support to an ActiveRecord model include the `ActiveSeo::Meta` Concern:
44
+
45
+ ```ruby
46
+ class Page < ApplicationRecord
47
+ include ActiveSeo::Meta
48
+ end
49
+ ```
50
+
51
+ This way SeoMetum's attributes will be automatically delegated by your model with the `seo` prefix.
52
+
53
+ E.g. in your the form:
54
+
55
+ ```erb
56
+ <%= form_for @page do |f| %>
57
+ <%= f.text_field :seo_title %>
58
+ <%= f.text_area :seo_description %>
59
+ <%= f.text_area :seo_keywords %>
60
+ <%= f.check_box :seo_noindex %>
61
+ <%= f.check_box :seo_nofollow %>
62
+ <% end %>
63
+ ```
64
+
65
+ To get a SEO attribute:
66
+
67
+ ```ruby
68
+ @page.seo_title
69
+ ```
70
+
71
+ To get all SEO attributes:
72
+
73
+ ```ruby
74
+ @page.seo_meta
75
+ ```
76
+
77
+ ## Configuration
78
+
79
+ The install generator will create an initializer, which contains the following:
80
+
81
+ ```ruby
82
+ ActiveSeo.setup do |config|
83
+ # config.title_limit = 70
84
+ # config.description_limit = 160
85
+ # config.keywords_limit = 255
86
+ # config.keywords_separator = ', '
87
+ # config.title_fallback = true
88
+ # config.description_fallback = true
89
+ # config.generate_keywords = true
90
+
91
+ # config.opengraph_setup do |og|
92
+ # og.type = 'website'
93
+ # og.site_name = 'Site Name'
94
+ # end
95
+
96
+ # config.twitter_setup do |tw|
97
+ # tw.card = 'summary'
98
+ # tw.site = '@site'
99
+ # tw.creator = '@author'
100
+ # end
101
+ end
102
+ ```
103
+
104
+ You can set global defaults for attribute validations, automatic meta generation, OpenGraph and Twitter meta.
105
+
106
+ Settings `title_fallback` and `description_fallback` can also accept either a `Symbol` which could be another model attribute or method, or an `Array` of attributes/methods to grab values from in order to autogenerate the title and description attributes.
107
+
108
+ This behavior can also be configured on a model level, so in your Page model you could do something like this:
109
+
110
+ ```ruby
111
+ class Page < ApplicationRecord
112
+ include ActiveSeo::Meta
113
+
114
+ # Set SEO config
115
+ seo_setup title_fallback: :name, description_fallback: [:content, :excerpt]
116
+ end
117
+ ```
118
+
119
+ ## OpenGraph and Twitter meta
120
+
121
+ If you want to define non-global OpenGraph and Twitter configurations you can create a custom meta contextualizer.
122
+
123
+ ActiveSeo will look for a class defined in the model e.g.:
124
+
125
+ ```ruby
126
+ class Page < ApplicationRecord
127
+ include ActiveSeo::Meta
128
+
129
+ # Set meta contextualizer
130
+ seo_contextualizer 'CustomContextualizer'
131
+ end
132
+ ```
133
+
134
+ or for a class located at `app/contextualizers` with a name like `PageContextualizer`.
135
+
136
+ ```ruby
137
+ class PageContextualizer < ActiveSeo::Contextualizer
138
+ # Using a proc
139
+ og_meta :image, -> obj { { _: obj.image, width: obj.image_width } }
140
+ # Using a method defined in the contextualizer
141
+ og_meta :video, :video_url
142
+
143
+ # Using an attribute from the record
144
+ twitter_meta :description, :seo_description
145
+ # Using a string
146
+ twitter_meta :card, 'app'
147
+
148
+ # Use `record` to get record attributes
149
+ def video_url
150
+ record.video_url
151
+ end
152
+ end
153
+ ```
154
+
155
+ #### Notes
156
+
157
+ Inside the contextualizer you can define values using a `Proc` which gives you access to the record, a `Symbol` which will look for an attibute or method first inside the contextualizer and then in the model, or a `String` for a static value.
158
+
159
+ ## Printing SEO meta
160
+
161
+ This gem does not provide helpers to output the meta, but was designed to provide a hash containing all the attributes the way the [Meta Tags](https://github.com/kpumuk/meta-tags) gem requires them.
162
+
163
+ So, if you're using Meta Tags you can do the following:
164
+
165
+ ```erb
166
+ <%= display_meta_tags(@page.seo_meta) %>
167
+ ```
168
+
169
+ ## Development
170
+
171
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
172
+
173
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
174
+
175
+ ## Contributing
176
+
177
+ Bug reports and pull requests are welcome on GitHub at https://github.com/hardpixel/active-seo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
178
+
179
+ ## License
180
+
181
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
182
+
183
+ ## Code of Conduct
184
+
185
+ Everyone interacting in the ActiveSeo project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hardpixel/active-seo/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
data/lib/active_seo.rb ADDED
@@ -0,0 +1,47 @@
1
+ require 'active_support'
2
+ require 'action_view'
3
+ require 'hashie'
4
+ require 'active_delegate'
5
+ require 'active_seo/helpers'
6
+ require 'active_seo/contextualize'
7
+ require 'active_seo/contextualizer'
8
+ require 'active_seo/meta'
9
+ require 'active_seo/seo_metum'
10
+ require 'active_seo/seo_meta'
11
+ require 'active_seo/version'
12
+
13
+ module ActiveSeo
14
+ # Config class
15
+ class Config < Hashie::Dash
16
+ # Set properties and defaults
17
+ property :title_limit, default: 70
18
+ property :description_limit, default: 160
19
+ property :keywords_limit, default: 255
20
+ property :title_fallback, default: true
21
+ property :description_fallback, default: true
22
+ property :generate_keywords, default: true
23
+ property :opengraph, default: {}
24
+ property :twitter, default: {}
25
+
26
+ def opengraph_setup(&block)
27
+ self.opengraph = Hashie::Mash.new
28
+ yield self.opengraph
29
+ end
30
+
31
+ def twitter_setup(&block)
32
+ self.twitter = Hashie::Mash.new
33
+ yield self.twitter
34
+ end
35
+ end
36
+
37
+ # Set attr accessors
38
+ mattr_accessor :config
39
+
40
+ # Set config options
41
+ @@config = Config.new
42
+
43
+ # Setup module config
44
+ def self.setup
45
+ yield config
46
+ end
47
+ end
@@ -0,0 +1,26 @@
1
+ module ActiveSeo
2
+ module Contextualize
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ attr_accessor :record, :config, :opengraph, :twitter
7
+
8
+ # Set class attributes
9
+ class_attribute :model_og_meta
10
+ class_attribute :model_twitter_meta
11
+
12
+ self.model_og_meta = {}
13
+ self.model_twitter_meta = {}
14
+ end
15
+
16
+ class_methods do
17
+ def og_meta(key, options)
18
+ self.model_og_meta[key] = options
19
+ end
20
+
21
+ def twitter_meta(key, options)
22
+ self.model_twitter_meta[key] = options
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,59 @@
1
+ module ActiveSeo
2
+ class Contextualizer
3
+ include ActiveSeo::Contextualize
4
+
5
+ def initialize(record)
6
+ @record = record
7
+ @config = record.class.seo_config
8
+ @opengraph = config.opengraph.merge(model_og_meta)
9
+ @twitter = config.twitter.merge(model_twitter_meta)
10
+ end
11
+
12
+ def og_meta
13
+ parse_meta(opengraph).deep_symbolize_keys
14
+ end
15
+
16
+ def twitter_meta
17
+ parse_meta(twitter).deep_symbolize_keys
18
+ end
19
+
20
+ private
21
+
22
+ def parse_meta(options)
23
+ meta = {}
24
+
25
+ if options.is_a? Hash
26
+ options.each do |key, value|
27
+ meta[key] = parse_values(key, value)
28
+ end
29
+ else
30
+ meta[key] = parse_values(key, value)
31
+ end
32
+
33
+ meta
34
+ end
35
+
36
+ def parse_values(key, value)
37
+ data = nil
38
+
39
+ case value
40
+ when Symbol
41
+ data = get_record_value value
42
+ when Proc
43
+ data = call_record_proc value
44
+ else
45
+ data = value
46
+ end
47
+
48
+ data
49
+ end
50
+
51
+ def get_record_value(attribute)
52
+ try(attribute) || record.try(attribute)
53
+ end
54
+
55
+ def call_record_proc(proc_method)
56
+ proc_method.call record
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,29 @@
1
+ module ActiveSeo
2
+ module Helpers
3
+ include ActionView::Helpers::SanitizeHelper
4
+
5
+ class << self
6
+ # Generate an array of keywords
7
+ def generate_keywords(text)
8
+ return [] unless text
9
+
10
+ keywords = text.to_s.scan(/\w+/)
11
+ keywords = keywords.group_by { |item| item }
12
+ keywords = Hash[keywords.sort_by { |_k, v| -v.size }]
13
+ keywords = keywords.keys.select { |item| item.size > 1 }
14
+
15
+ keywords.map(&:downcase)
16
+ end
17
+
18
+ def sanitize_keywords(text)
19
+ text = strip_tags(text)
20
+ text.scan(/\w+/).join(' ').downcase
21
+ end
22
+
23
+ # Strip tags
24
+ def strip_tags(html)
25
+ full_sanitizer.sanitize(html)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,51 @@
1
+ module ActiveSeo
2
+ module Meta
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ # Include modules
7
+ include ActiveDelegate
8
+
9
+ # Set class attributes
10
+ class_attribute :seo_config, instance_predicate: false
11
+ class_attribute :seo_context, instance_predicate: false
12
+
13
+ # Set class attibute defaults
14
+ self.seo_config = ActiveSeo.config
15
+
16
+ # Has associations
17
+ has_one :active_seo_metum, as: :seoable, class_name: 'ActiveSeo::SeoMetum', autosave: true, dependent: :destroy
18
+
19
+ # Delegate attributes
20
+ delegate_attributes to: :active_seo_metum, prefix: 'seo', allow_nil: true
21
+
22
+ # Add validations
23
+ define_seo_validations
24
+ before_validation { ActiveSeo::Helpers.sanitize_keywords(seo_keywords) if seo_keywords? }
25
+ end
26
+
27
+ class_methods do
28
+ # Setup seo
29
+ def seo_setup(options={})
30
+ self.seo_config = seo_config.merge ActiveSeo::Config.new(options)
31
+ define_seo_validations
32
+ end
33
+
34
+ # Set meta contextualizer
35
+ def seo_contextualizer(name)
36
+ self.seo_context = name
37
+ end
38
+
39
+ # Set validations
40
+ def define_seo_validations
41
+ validates :seo_title, length: { maximum: seo_config.title_limit }, allow_blank: true
42
+ validates :seo_description, length: { maximum: seo_config.description_limit }, allow_blank: true
43
+ validates :seo_keywords, length: { maximum: seo_config.keywords_limit }, allow_blank: true
44
+ end
45
+ end
46
+
47
+ def seo_meta
48
+ @seo_meta ||= ActiveSeo::SeoMeta.new(self).result
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,91 @@
1
+ module ActiveSeo
2
+ class SeoMeta
3
+ attr_accessor :record, :config, :context
4
+
5
+ # Initializer method
6
+ def initialize(record)
7
+ @record = record
8
+ @config = record.class.seo_config
9
+ @context = contextualizer.new(record)
10
+ end
11
+
12
+ # Set base seo meta
13
+ def result
14
+ data = [:title, :description, :keywords, :noindex, :nofollow, :og, :twitter]
15
+ Hash[data.map { |i| [i, send(i)] }]
16
+ end
17
+
18
+ def title
19
+ attribute = :seo_title
20
+ defaults = [:title, :name]
21
+
22
+ attribute_fallbacks_for(attribute, defaults, config.title_fallback)
23
+ end
24
+
25
+ def description
26
+ attribute = :seo_description
27
+ defaults = [:content, :description, :excerpt, :body]
28
+
29
+ attribute_fallbacks_for(attribute, defaults, config.description_fallback)
30
+ end
31
+
32
+ def keywords
33
+ text = record.try :seo_keywords
34
+ text = "#{title} #{description}" if generate_keywords?(text)
35
+
36
+ helpers.generate_keywords(text)
37
+ end
38
+
39
+ def noindex
40
+ record.seo_noindex || false
41
+ end
42
+
43
+ def nofollow
44
+ record.seo_nofollow || false
45
+ end
46
+
47
+ def og
48
+ @config.opengraph.merge(context.og_meta)
49
+ end
50
+
51
+ def twitter
52
+ @config.twitter.merge(context.twitter_meta)
53
+ end
54
+
55
+ private
56
+
57
+ def contextualizer
58
+ "#{record.class.seo_context}".safe_constantize ||
59
+ "#{record.class.name}Contextualizer".safe_constantize ||
60
+ 'ActiveSeo::Contextualizer'.constantize
61
+ end
62
+
63
+ def helpers
64
+ ActiveSeo::Helpers
65
+ end
66
+
67
+ def generate_keywords?(text=nil)
68
+ config.generate_keywords and text.blank?
69
+ end
70
+
71
+ def attribute_fallbacks_for(attribute, defaults, fallback)
72
+ candidates = [attribute]
73
+
74
+ case fallback
75
+ when TrueClass
76
+ candidates.concat(defaults)
77
+ when Symbol
78
+ candidates << fallback
79
+ when Array
80
+ candidates.concat(fallback)
81
+ end
82
+
83
+ attribute_fallbacks(candidates)
84
+ end
85
+
86
+ def attribute_fallbacks(candidates)
87
+ method = candidates.find { |item| record.try(item).present? }
88
+ helpers.strip_tags(record.try(method).to_s) unless method.nil?
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,9 @@
1
+ module ActiveSeo
2
+ class SeoMetum < ActiveRecord::Base
3
+ # Set table name
4
+ self.table_name = 'seo_meta'
5
+
6
+ # Belongs associations
7
+ belongs_to :seoable, polymorphic: true, optional: true
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module ActiveSeo
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,24 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+ require 'rails/generators/active_record'
4
+
5
+ module ActiveSeo
6
+ class InstallGenerator < Rails::Generators::Base
7
+ include Rails::Generators::Migration
8
+
9
+ desc 'Generates migrations to add SEO meta tables.'
10
+ source_root File.expand_path('../templates', __FILE__)
11
+
12
+ def create_migration_file
13
+ migration_template 'migration/migration.rb', 'db/migrate/create_seo_meta.rb'
14
+ end
15
+
16
+ def create_config_file
17
+ template 'initializer/initializer.rb', 'config/initializers/active_seo.rb'
18
+ end
19
+
20
+ def self.next_migration_number(dirname)
21
+ ::ActiveRecord::Generators::Base.next_migration_number(dirname)
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,20 @@
1
+ ActiveSeo.setup do |config|
2
+ # config.title_limit = 70
3
+ # config.description_limit = 160
4
+ # config.keywords_limit = 255
5
+ # config.keywords_separator = ', '
6
+ # config.title_fallback = true
7
+ # config.description_fallback = true
8
+ # config.generate_keywords = true
9
+
10
+ # config.opengraph_setup do |og|
11
+ # og.type = 'website'
12
+ # og.site_name = 'Site Name'
13
+ # end
14
+
15
+ # config.twitter_setup do |tw|
16
+ # tw.card = 'summary'
17
+ # tw.site = '@site'
18
+ # tw.creator = '@author'
19
+ # end
20
+ end
@@ -0,0 +1,17 @@
1
+ class CreateSeoMeta < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :seo_meta do |t|
4
+ t.string :title
5
+ t.text :description
6
+ t.text :keywords
7
+ t.boolean :noindex
8
+ t.boolean :nofollow
9
+ t.integer :seoable_id, null: false
10
+ t.string :seoable_type, null: false
11
+
12
+ t.timestamps
13
+ end
14
+
15
+ add_index :seo_meta, [:seoable_id, :seoable_type], unique: true
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_seo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Olibia Tsati
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-11-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: actionview
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: active_delegate
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: hashie
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.5'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.5'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.14'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.14'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '5.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '5.0'
111
+ description: Optimize ActiveRecord models with support for SEO, Twitter and Open Graph
112
+ meta.
113
+ email:
114
+ - olibia@hardpixel.eu
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - CODE_OF_CONDUCT.md
120
+ - Gemfile
121
+ - LICENSE.txt
122
+ - README.md
123
+ - Rakefile
124
+ - lib/active_seo.rb
125
+ - lib/active_seo/contextualize.rb
126
+ - lib/active_seo/contextualizer.rb
127
+ - lib/active_seo/helpers.rb
128
+ - lib/active_seo/meta.rb
129
+ - lib/active_seo/seo_meta.rb
130
+ - lib/active_seo/seo_metum.rb
131
+ - lib/active_seo/version.rb
132
+ - lib/generators/active_seo/install_generator.rb
133
+ - lib/generators/active_seo/templates/initializer/initializer.rb
134
+ - lib/generators/active_seo/templates/migration/migration.rb
135
+ homepage: https://github.com/hardpixel/active-seo
136
+ licenses:
137
+ - MIT
138
+ metadata: {}
139
+ post_install_message:
140
+ rdoc_options: []
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ requirements: []
154
+ rubyforge_project:
155
+ rubygems_version: 2.6.13
156
+ signing_key:
157
+ specification_version: 4
158
+ summary: Add SEO meta to ActiveRecord models
159
+ test_files: []