seo_meta 1.4.0 → 2.0.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/models/seo_metum.rb +4 -2
- data/config/locales/ca.yml +8 -0
- data/config/locales/ru.yml +1 -1
- data/lib/generators/seo_meta_generator.rb +1 -1
- data/lib/seo_meta.rb +13 -6
- data/readme.md +70 -62
- metadata +24 -33
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7a12ad76bad0bb9050cee4c444c3ac705943ee63
|
4
|
+
data.tar.gz: 9c2d5bd4718ecc53b243c2590361b195b3bd260b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3f4497ab31e856aefe90300d53b8e2aabbce77d8acc35d85e2694a7d04cc7f650f7e34637aa3a9fd08431784b323ee9d6299a473620fe453529b2fc78f934a17
|
7
|
+
data.tar.gz: a4ccadf7395cf6f6a3ff931cf4eefdf796322e96d25f6798e106105bc36a1da7d252ef76616d88aabe6654735803407b68d56a145babaa14e35dc1898214cd86
|
data/app/models/seo_metum.rb
CHANGED
@@ -0,0 +1,8 @@
|
|
1
|
+
ca:
|
2
|
+
seo_meta:
|
3
|
+
form:
|
4
|
+
seo: Optimització per a Cercadors (SEO)
|
5
|
+
seo_override_title: Títol del navegador
|
6
|
+
seo_override_title_help: Escriu un títol de 5 a 10 paraules que resumeixi el contingut d'aquesta publicació.
|
7
|
+
meta_description_title: Meta descripció
|
8
|
+
meta_description_help: Escriu dues o tres frases concises que descriguin de què tracta aquesta publicació.
|
data/config/locales/ru.yml
CHANGED
@@ -4,5 +4,5 @@ ru:
|
|
4
4
|
seo: Поисковая оптимизация
|
5
5
|
seo_override_title: Заголовок браузера
|
6
6
|
seo_override_title_help: "Введите заголовок из 5–10 слов, которые описывают текст на этой странице."
|
7
|
-
meta_description_title:
|
7
|
+
meta_description_title: Мета-описание
|
8
8
|
meta_description_help: "Введите два-три коротких предложения, описывающих страницу."
|
data/lib/seo_meta.rb
CHANGED
@@ -12,19 +12,26 @@ module SeoMeta
|
|
12
12
|
end
|
13
13
|
|
14
14
|
class Engine < ::Rails::Engine
|
15
|
-
|
15
|
+
engine_name 'seo_meta' if Rails.version.to_s >= '3.1.0'
|
16
16
|
end
|
17
17
|
|
18
18
|
autoload :InstanceMethods, File.expand_path('../seo_meta/instance_methods', __FILE__)
|
19
|
-
|
20
19
|
end
|
21
20
|
|
22
21
|
def is_seo_meta(options = {})
|
23
22
|
if included_modules.exclude?(::SeoMeta::InstanceMethods)
|
24
23
|
# Let the base know about SeoMetum
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
has_one_options = {
|
25
|
+
:class_name => 'SeoMetum',
|
26
|
+
:foreign_key => :seo_meta_id,
|
27
|
+
:dependent => :destroy
|
28
|
+
}.merge(options.slice(:class_name, :foreign_key, :dependent))
|
29
|
+
|
30
|
+
if ActiveRecord::VERSION::STRING >= '4.0.0'
|
31
|
+
has_one :seo_meta, proc { where(:seo_meta_type => self.name) }, has_one_options
|
32
|
+
else
|
33
|
+
has_one :seo_meta, {:conditions => {:seo_meta_type => self.name}}.merge(has_one_options)
|
34
|
+
end
|
28
35
|
|
29
36
|
# Let SeoMetum know about the base
|
30
37
|
::SeoMetum.send :belongs_to, self.name.underscore.gsub('/', '_').to_sym,
|
@@ -42,4 +49,4 @@ def is_seo_meta(options = {})
|
|
42
49
|
|
43
50
|
fields << {:to => :seo_meta}
|
44
51
|
delegate *fields
|
45
|
-
end
|
52
|
+
end
|
data/readme.md
CHANGED
@@ -6,14 +6,18 @@
|
|
6
6
|
|
7
7
|
Add to your project using your Bundler Gemfile:
|
8
8
|
|
9
|
-
|
9
|
+
```ruby
|
10
|
+
gem 'seo_meta'
|
11
|
+
```
|
10
12
|
|
11
13
|
Include in your model by calling the method `is_seo_meta` in the class declaration,
|
12
14
|
for example with `Page`:
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
```ruby
|
17
|
+
class Page < ActiveRecord::Base
|
18
|
+
is_seo_meta
|
19
|
+
end
|
20
|
+
```
|
17
21
|
|
18
22
|
Run the generator:
|
19
23
|
|
@@ -31,67 +35,69 @@ At this point you could add to the migration that is generated in `db/migrate/`
|
|
31
35
|
logic to migrate across your existing data and remove the columns from your model
|
32
36
|
afterward, for example with `Page`:
|
33
37
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
# Reset column information because otherwise the old columns will still exist.
|
50
|
-
::Page.reset_column_information
|
51
|
-
|
52
|
-
# Re-attach seo_meta
|
53
|
-
::Page.module_eval do
|
54
|
-
is_seo_meta
|
55
|
-
end
|
56
|
-
|
57
|
-
# Migrate data
|
58
|
-
existing_pages.each do |page|
|
59
|
-
::Page.find(page['id']).update_attributes({
|
60
|
-
::SeoMeta.attributes.keys.inject({}) {|attributes, name|
|
61
|
-
attributes.merge(name => translation[name.to_s])
|
62
|
-
}
|
63
|
-
})
|
64
|
-
end
|
38
|
+
```ruby
|
39
|
+
class CreateSeoMeta < ActiveRecord::Migration
|
40
|
+
|
41
|
+
def self.up
|
42
|
+
# ... migration logic from the seo_meta generator ...
|
43
|
+
|
44
|
+
# Grab the attributes of the records that currently exist
|
45
|
+
existing_pages = ::Page.all.map(&:attributes)
|
46
|
+
|
47
|
+
# Remove columns
|
48
|
+
::SeoMeta.attributes.each do |field|
|
49
|
+
if ::Page.column_names.map(&:to_sym).include?(field)
|
50
|
+
remove_column ::Page.table_name, field
|
65
51
|
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Reset column information because otherwise the old columns will still exist.
|
55
|
+
::Page.reset_column_information
|
66
56
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
# ... migration logic from the seo_meta generator ...
|
57
|
+
# Re-attach seo_meta
|
58
|
+
::Page.module_eval do
|
59
|
+
is_seo_meta
|
60
|
+
end
|
61
|
+
|
62
|
+
# Migrate data
|
63
|
+
existing_pages.each do |page|
|
64
|
+
::Page.find(page['id']).update_attributes({
|
65
|
+
::SeoMeta.attributes.keys.inject({}) {|attributes, name|
|
66
|
+
attributes.merge(name => translation[name.to_s])
|
67
|
+
}
|
68
|
+
})
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.down
|
73
|
+
# Grab the attributes of the records that currently exist
|
74
|
+
existing_pages = ::Page.all.map(&:attributes)
|
75
|
+
|
76
|
+
# Add columns back to your model
|
77
|
+
::SeoMeta.attributes.each do |field, field_type|
|
78
|
+
unless ::Page.column_names.map(&:to_sym).include?(field)
|
79
|
+
add_column ::Page.table_name, field, field_type
|
91
80
|
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Reset column information because otherwise the new columns won't exist yet.
|
84
|
+
::Page.reset_column_information
|
92
85
|
|
86
|
+
# Migrate data
|
87
|
+
existing_pages.each do |page|
|
88
|
+
::Page.find(page['id']).update_attributes({
|
89
|
+
::SeoMeta.attributes.keys.inject({}) {|attributes, name|
|
90
|
+
attributes.merge(name => translation[name.to_s])
|
91
|
+
}
|
92
|
+
})
|
93
93
|
end
|
94
94
|
|
95
|
+
# ... migration logic from the seo_meta generator ...
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
```
|
100
|
+
|
95
101
|
Now, run:
|
96
102
|
|
97
103
|
rake db:migrate
|
@@ -102,9 +108,11 @@ You can use the included partial if you want a ready made form for the new SEO f
|
|
102
108
|
Note that the `:form` local variable is required and should be a form builder object
|
103
109
|
from a `form_for` block, for example:
|
104
110
|
|
105
|
-
|
106
|
-
|
107
|
-
|
111
|
+
```erb
|
112
|
+
<%= form_for @page do |f| -%>
|
113
|
+
<%= render '/seo_meta/form', :form => f %>
|
114
|
+
<% end %>
|
115
|
+
```
|
108
116
|
|
109
117
|
## Anything else?
|
110
118
|
|
metadata
CHANGED
@@ -1,82 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seo_meta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0.rc.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Philip Arndt
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-10-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: combustion
|
16
|
-
prerelease: false
|
17
15
|
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
|
-
none: false
|
23
20
|
type: :development
|
21
|
+
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
23
|
requirements:
|
26
|
-
- -
|
24
|
+
- - '>='
|
27
25
|
- !ruby/object:Gem::Version
|
28
26
|
version: '0'
|
29
|
-
none: false
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
name: rspec
|
32
|
-
prerelease: false
|
28
|
+
name: rspec
|
33
29
|
requirement: !ruby/object:Gem::Requirement
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
|
-
none: false
|
39
34
|
type: :development
|
35
|
+
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
37
|
requirements:
|
42
|
-
- -
|
38
|
+
- - '>='
|
43
39
|
- !ruby/object:Gem::Version
|
44
40
|
version: '0'
|
45
|
-
none: false
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: sqlite3
|
48
|
-
prerelease: false
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
|
-
none: false
|
55
48
|
type: :development
|
49
|
+
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
|
-
- -
|
52
|
+
- - '>='
|
59
53
|
- !ruby/object:Gem::Version
|
60
54
|
version: '0'
|
61
|
-
none: false
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: railties
|
64
|
-
prerelease: false
|
65
57
|
requirement: !ruby/object:Gem::Requirement
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: 3.0.0
|
70
|
-
none: false
|
71
62
|
type: :runtime
|
63
|
+
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
65
|
requirements:
|
74
|
-
- -
|
66
|
+
- - '>='
|
75
67
|
- !ruby/object:Gem::Version
|
76
68
|
version: 3.0.0
|
77
|
-
none: false
|
78
69
|
description: SEO Meta tags plugin for Ruby on Rails
|
79
|
-
email:
|
70
|
+
email: p@arndt.io
|
80
71
|
executables: []
|
81
72
|
extensions: []
|
82
73
|
extra_rdoc_files: []
|
@@ -90,6 +81,7 @@ files:
|
|
90
81
|
- app/models/seo_metum.rb
|
91
82
|
- app/views/seo_meta/_form.html.erb
|
92
83
|
- config/locales/bg.yml
|
84
|
+
- config/locales/ca.yml
|
93
85
|
- config/locales/cs.yml
|
94
86
|
- config/locales/da.yml
|
95
87
|
- config/locales/de.yml
|
@@ -115,30 +107,29 @@ files:
|
|
115
107
|
- config/locales/zh-TW.yml
|
116
108
|
- license.md
|
117
109
|
- readme.md
|
118
|
-
homepage: http://
|
110
|
+
homepage: http://p.arndt.io
|
119
111
|
licenses:
|
120
112
|
- MIT
|
113
|
+
metadata: {}
|
121
114
|
post_install_message:
|
122
115
|
rdoc_options: []
|
123
116
|
require_paths:
|
124
117
|
- lib
|
125
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
126
119
|
requirements:
|
127
|
-
- -
|
120
|
+
- - '>='
|
128
121
|
- !ruby/object:Gem::Version
|
129
122
|
version: '0'
|
130
|
-
none: false
|
131
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
124
|
requirements:
|
133
|
-
- -
|
125
|
+
- - '>'
|
134
126
|
- !ruby/object:Gem::Version
|
135
|
-
version:
|
136
|
-
none: false
|
127
|
+
version: 1.3.1
|
137
128
|
requirements: []
|
138
129
|
rubyforge_project:
|
139
|
-
rubygems_version: 1.
|
130
|
+
rubygems_version: 2.1.0
|
140
131
|
signing_key:
|
141
|
-
specification_version:
|
132
|
+
specification_version: 4
|
142
133
|
summary: SEO Meta tags plugin
|
143
134
|
test_files: []
|
144
135
|
has_rdoc:
|