search-engine-optimization 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 258c5ac5446d779f00fc9b110f26fe5cd1ad5739ac57314ef9610a060db5d992
4
+ data.tar.gz: 6dfa24867ab4001e699e063a8a13f7c52631be4eeb30d18b3372c5a00dfd038d
5
+ SHA512:
6
+ metadata.gz: b534e2972e55e06c1efc3d1f3475380d242d767ec115cd8c7a19cdfd8e46b885f117c154c84d5c45ee30e4c1e7b996d561561b1031cfa80c0d2ec9f29e1fa149
7
+ data.tar.gz: 775feca341c3c1298ea8b70c4b0f977f526381c0e195662a5b6224471941a29207e19d73225c055740a5c98427e0258b120579eb83a2f389ca4b890d60627e78
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ### master
4
+
5
+ * nothing yet
6
+
7
+ ### 1.0.0 - 2018/01/27
8
+
9
+ * initial release
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Jonas Hübotter
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,118 @@
1
+ # Search Engine Optimization
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/search-engine-optimization.svg)](https://badge.fury.io/rb/search-engine-optimization) <img src="https://travis-ci.org/jonhue/search-engine-optimization.svg?branch=master" />
4
+
5
+ Advanced SEO for Rails apps with schema tags.
6
+
7
+ ---
8
+
9
+ ## Table of Contents
10
+
11
+ * [Installation](#installation)
12
+ * [Usage](#philosophy)
13
+ * [Meta tags](#meta-tags)
14
+ * [Schemas](#schemas)
15
+ * [To Do](#to-do)
16
+ * [Contributing](#contributing)
17
+ * [Contributors](#contributors)
18
+ * [Semantic versioning](#semantic-versioning)
19
+ * [License](#license)
20
+
21
+ ---
22
+
23
+ ## Installation
24
+
25
+ Search Engine Optimization works with Rails 5 onwards. You can add it to your `Gemfile` with:
26
+
27
+ ```ruby
28
+ gem 'search-engine-optimization'
29
+ ```
30
+
31
+ And then execute:
32
+
33
+ $ bundle
34
+
35
+ Or install it yourself as:
36
+
37
+ $ gem install search-engine-optimization
38
+
39
+ If you always want to be up to date fetch the latest from GitHub in your `Gemfile`:
40
+
41
+ ```ruby
42
+ gem 'search-engine-optimization', github: 'jonhue/search-engine-optimization'
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Usage
48
+
49
+ ### Meta tags
50
+
51
+ Use [metamagic](https://github.com/lassebunk/metamagic) to add titles and descriptions to your views.
52
+
53
+ ### Schemas
54
+
55
+ Search Engine Optimization assists you in creating schema tags that will enhance SERPs and click rates.
56
+
57
+ Use the `seo/schema` component:
58
+
59
+ ```haml
60
+ = component 'seo/schema', type: :article, options
61
+ ```
62
+
63
+ Here is a list of available types:
64
+
65
+ * [`:aggregate_rating`](components/schemas/aggregate_rating.md)
66
+ * [`:article`](components/schemas/article.md)
67
+ * [`:organization`](components/schemas/organization.md)
68
+ * [`:person`](components/schemas/person.md)
69
+
70
+ ---
71
+
72
+ ## To Do
73
+
74
+ [Here](https://github.com/jonhue/search-engine-optimization/projects/1) is the full list of current projects.
75
+
76
+ To propose your ideas, initiate the discussion by adding a [new issue](https://github.com/jonhue/search-engine-optimization/issues/new).
77
+
78
+ ---
79
+
80
+ ## Contributing
81
+
82
+ We hope that you will consider contributing to Search Engine Optimization. Please read this short overview for some information about how to get started:
83
+
84
+ [Learn more about contributing to this repository](CONTRIBUTING.md), [Code of Conduct](CODE_OF_CONDUCT.md)
85
+
86
+ ### Contributors
87
+
88
+ Give the people some :heart: who are working on this project. See them all at:
89
+
90
+ https://github.com/jonhue/search-engine-optimization/graphs/contributors
91
+
92
+ ### Semantic Versioning
93
+
94
+ Search Engine Optimization follows Semantic Versioning 2.0 as defined at http://semver.org.
95
+
96
+ ## License
97
+
98
+ MIT License
99
+
100
+ Copyright (c) 2018 Jonas Hübotter
101
+
102
+ Permission is hereby granted, free of charge, to any person obtaining a copy
103
+ of this software and associated documentation files (the "Software"), to deal
104
+ in the Software without restriction, including without limitation the rights
105
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
106
+ copies of the Software, and to permit persons to whom the Software is
107
+ furnished to do so, subject to the following conditions:
108
+
109
+ The above copyright notice and this permission notice shall be included in all
110
+ copies or substantial portions of the Software.
111
+
112
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
113
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
114
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
115
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
116
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
117
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
118
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ <script type="application/ld+json">
2
+ {
3
+ "@context" : "http://schema.org",
4
+ <%= component "seo/schema/#{options[:type].underscore}", options %>
5
+ }
6
+ </script>
@@ -0,0 +1,3 @@
1
+ "@type" : "AggregateRating"
2
+
3
+ <%= component 'seo/schema/properties/ratingValue', rating_value: options[:rating_value] %>
@@ -0,0 +1,11 @@
1
+ "@type" : "Article",
2
+ "aggregateRating" : { <%= component 'seo/schema/aggregate_rating', options[:aggregate_rating] %> },
3
+ "author" : { <%= component 'seo/schema/person', options[:author] %> },
4
+ "publisher" : { <%= component 'seo/schema/organization', options[:publisher] %> }
5
+
6
+ <%= component 'seo/schema/properties/articleBody', article_body: options[:article_body] %>
7
+ <%= component 'seo/schema/properties/articleSection', article_section: options[:article_section] %>
8
+ <%= component 'seo/schema/properties/datePublished', date_published: options[:date_published] %>
9
+ <%= component 'seo/schema/properties/image', image: options[:image] %>
10
+ <%= component 'seo/schema/properties/name', name: options[:name] %>
11
+ <%= component 'seo/schema/properties/url', url: options[:url] %>
@@ -0,0 +1,3 @@
1
+ "@type" : "Organization"
2
+
3
+ <%= component 'seo/schema/properties/name', name: options[:name] %>
@@ -0,0 +1,3 @@
1
+ "@type" : "Person"
2
+
3
+ <%= component 'seo/schema/properties/name', name: options[:name] %>
@@ -0,0 +1 @@
1
+ , "articleBody": "<%= options[:article_body] %>"
@@ -0,0 +1 @@
1
+ , "articleSection": "<%= options[:article_section] %>"
@@ -0,0 +1 @@
1
+ , "datePublished": "<%= options[:date_published] %>"
@@ -0,0 +1 @@
1
+ , "image": "<%= options[:image] %>"
@@ -0,0 +1 @@
1
+ , "name": "<%= options[:name] %>"
@@ -0,0 +1 @@
1
+ , "ratingValue": "<%= options[:rating_value] %>"
@@ -0,0 +1 @@
1
+ , "url": "<%= options[:url] %>"
@@ -0,0 +1,8 @@
1
+ require 'search_engine_optimization/version'
2
+
3
+ module SearchEngineOptimization
4
+
5
+ require 'search_engine_optimization/engine'
6
+ require 'search_engine_optimization/railtie'
7
+
8
+ end
@@ -0,0 +1,6 @@
1
+ require 'rails/railtie'
2
+
3
+ module SearchEngineOptimization
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
@@ -0,0 +1,49 @@
1
+ require 'mozaic'
2
+ require 'rails/railtie'
3
+
4
+ module SearchEngineOptimization
5
+ class Railtie < Rails::Railtie
6
+
7
+ include ActionView::Helpers::AssetUrlHelper
8
+
9
+ initializer 'search-engine-optimization.mozaic' do
10
+ Mozaic.configure do |config|
11
+
12
+ config.define_component 'seo/schema' do |options|
13
+ false if options[:type].nil?
14
+ end
15
+
16
+ config.define_component 'seo/schema/aggregate_rating'
17
+ config.define_component 'seo/schema/article'
18
+ config.define_component 'seo/schema/organization'
19
+ config.define_component 'seo/schema/person'
20
+
21
+ config.define_component 'seo/schema/properties/articleBody' do |options|
22
+ false if options[:article_body].nil?
23
+ end
24
+ config.define_component 'seo/schema/properties/articleSection' do |options|
25
+ false if options[:article_section].nil?
26
+ end
27
+ config.define_component 'seo/schema/properties/datePublished' do |options|
28
+ options[:date_published] = options[:date_published]&.iso8601
29
+ false if options[:date_published].nil?
30
+ end
31
+ config.define_component 'seo/schema/properties/image' do |options|
32
+ options[:image] = image_url options[:image] unless options[:image].nil? || options[:image].include?('http')
33
+ false if options[:image].nil?
34
+ end
35
+ config.define_component 'seo/schema/properties/name' do |options|
36
+ false if options[:name].nil?
37
+ end
38
+ config.define_component 'seo/schema/properties/ratingValue' do |options|
39
+ false if options[:rating_value].nil?
40
+ end
41
+ config.define_component 'seo/schema/properties/url' do |options|
42
+ false if options[:url].nil?
43
+ end
44
+
45
+ end
46
+ end
47
+
48
+ end
49
+ end
@@ -0,0 +1,5 @@
1
+ module SearchEngineOptimization
2
+
3
+ VERSION = '1.0.0'
4
+
5
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: search-engine-optimization
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jonas Hübotter
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-01-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
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: mozaic
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.52'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.52'
69
+ description: Advanced SEO for Rails apps with schema tags.
70
+ email: me@jonhue.me
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - CHANGELOG.md
76
+ - LICENSE
77
+ - README.md
78
+ - app/views/mozaic/seo/_schema.html.erb
79
+ - app/views/mozaic/seo/schema/_aggregate_rating.html.erb
80
+ - app/views/mozaic/seo/schema/_article.html.erb
81
+ - app/views/mozaic/seo/schema/_organization.html.erb
82
+ - app/views/mozaic/seo/schema/_person.html.erb
83
+ - app/views/mozaic/seo/schema/properties/_articleBody.html.erb
84
+ - app/views/mozaic/seo/schema/properties/_articleSection.html.erb
85
+ - app/views/mozaic/seo/schema/properties/_datePublished.html.erb
86
+ - app/views/mozaic/seo/schema/properties/_image.html.erb
87
+ - app/views/mozaic/seo/schema/properties/_name.html.erb
88
+ - app/views/mozaic/seo/schema/properties/_ratingValue.html.erb
89
+ - app/views/mozaic/seo/schema/properties/_url.html.erb
90
+ - lib/search-engine-optimization.rb
91
+ - lib/search_engine_optimization/engine.rb
92
+ - lib/search_engine_optimization/railtie.rb
93
+ - lib/search_engine_optimization/version.rb
94
+ homepage: https://github.com/jonhue/search-engine-optimization
95
+ licenses:
96
+ - MIT
97
+ metadata: {}
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '2.3'
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubyforge_project:
114
+ rubygems_version: 2.7.4
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: Advanced SEO for Rails apps
118
+ test_files: []