seo_helper 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in seo_helper.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,9 @@
1
+ require "seo_helper/helper"
2
+
3
+ module SeoImageHelper
4
+ class Engine < ::Rails::Engine
5
+ initializer "seo_helper.view_helpers" do
6
+ ActionView::Base.send :include, SeoHelper::Helper
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,42 @@
1
+ module SeoHelper
2
+ module Helper
3
+
4
+ def meta_title(title)
5
+ return nil if title.blank?
6
+ title = title + " | " + (SITE_NAME rescue "SITE_NAME")
7
+ tag(:meta, {:name => "title", :content => title})
8
+ end
9
+
10
+ def meta_description(content, site_name = false)
11
+ return nil if content.blank?
12
+ content = content + " | " + (SITE_NAME rescue "SITE_NAME") if site_name
13
+ tag(:meta, { :name => "description", :content => strip_tags(content) }, true)
14
+ end
15
+
16
+ def meta_keywords(word)
17
+ return nil if word.blank?
18
+ # word = word + (SITE_NAME rescue "SITE_NAME")
19
+ tag(:meta, {:name => "keywords", :content => word})
20
+ end
21
+
22
+ def render_rel_image(image_url)
23
+ return nil if image_url.blank?
24
+ tag(:link, {:rel => "image_src", :href => image_url})
25
+ end
26
+
27
+ def link_image(image_url)
28
+ return nil if image_url.blank?
29
+ tag(:link, { :rel => "image_src", :href => image_url }, true)
30
+ end
31
+
32
+ def link_favicon(ico_url = "/favicon.ico")
33
+ tag(:link, { :rel => "shortcut icon", :href => ico_url }, true)
34
+ end
35
+
36
+
37
+ def meta_robots(content = "INDEX,FOLLOW")
38
+ tag(:meta, { :name => "robots", :content => content }, true)
39
+ end
40
+ end
41
+
42
+ end
@@ -0,0 +1,9 @@
1
+ require "seo_helper/helper"
2
+
3
+ module SeoImageHelper
4
+ class Railtie < Rails::Railtie
5
+ initializer "seo_helper.view_helpers" do
6
+ ActionView::Base.send :include, SeoHelper::Helper
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module SeoHelper
2
+ VERSION = "0.1.0"
3
+ end
data/lib/seo_helper.rb ADDED
@@ -0,0 +1,9 @@
1
+ module SeoHelper
2
+ module Rails
3
+ if ::Rails.version < "3.1"
4
+ require "seo_helper/railtie"
5
+ else
6
+ require "seo_helper/engine"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/seo_helper/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["xdite"]
6
+ gem.email = ["xdite@techbang.com.tw"]
7
+ gem.description = %q{SEO helper of Techbang}
8
+ gem.summary = %q{SEO helper of Techbang}
9
+ gem.homepage = ""
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "seo_helper"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = SeoHelper::VERSION
17
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: seo_helper
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - xdite
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-12-22 00:00:00 +08:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: SEO helper of Techbang
23
+ email:
24
+ - xdite@techbang.com.tw
25
+ executables: []
26
+
27
+ extensions: []
28
+
29
+ extra_rdoc_files: []
30
+
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - Rakefile
35
+ - lib/seo_helper.rb
36
+ - lib/seo_helper/engine.rb
37
+ - lib/seo_helper/helper.rb
38
+ - lib/seo_helper/railtie.rb
39
+ - lib/seo_helper/version.rb
40
+ - seo_helper.gemspec
41
+ has_rdoc: true
42
+ homepage: ""
43
+ licenses: []
44
+
45
+ post_install_message:
46
+ rdoc_options: []
47
+
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 3
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ requirements: []
69
+
70
+ rubyforge_project:
71
+ rubygems_version: 1.5.2
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: SEO helper of Techbang
75
+ test_files: []
76
+