Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e1bb2be
Showing
7 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
*.gem | ||
*.rbc | ||
.bundle | ||
.config | ||
.yardoc | ||
Gemfile.lock | ||
InstalledFiles | ||
_yardoc | ||
coverage | ||
doc/ | ||
lib/bundler/man | ||
pkg | ||
rdoc | ||
spec/reports | ||
test/tmp | ||
test/version_tmp | ||
tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source 'http://rubygems.org' | ||
|
||
# Specify your gem's dependencies in seo_helper.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env rake | ||
require "bundler/gem_tasks" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
require "seo_helper/version" | ||
require 'seo_helper/railtie' if defined?(Rails) | ||
module SeoHelper | ||
|
||
def meta_title(title) | ||
return nil if title.blank? | ||
title = title + " | " + (SITE_NAME rescue "SITE_NAME") | ||
tag(:meta, {:name => "title", :content => title}) | ||
end | ||
|
||
def meta_description(content, site_name = false) | ||
return nil if content.blank? | ||
content = content + " | " + (SITE_NAME rescue "SITE_NAME") if site_name | ||
tag(:meta, { :name => "description", :content => strip_tags(content) }, true) | ||
end | ||
|
||
def meta_keywords(word) | ||
return nil if word.blank? | ||
# word = word + (SITE_NAME rescue "SITE_NAME") | ||
tag(:meta, {:name => "keywords", :content => word}) | ||
end | ||
|
||
def render_rel_image(image_url) | ||
return nil if image_url.blank? | ||
tag(:link, {:rel => "image_src", :href => image_url}) | ||
end | ||
|
||
def link_image(image_url) | ||
return nil if image_url.blank? | ||
tag(:link, { :rel => "image_src", :href => image_url }, true) | ||
end | ||
|
||
def link_favicon(ico_url = "/favicon.ico") | ||
tag(:link, { :rel => "shortcut icon", :href => ico_url }, true) | ||
end | ||
|
||
|
||
def meta_robots(content = "INDEX,FOLLOW") | ||
tag(:meta, { :name => "robots", :content => content }, true) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require "seo_helper" | ||
|
||
module SeoImageHelper | ||
class Railtie < Rails::Railtie | ||
initializer "seo_helper.view_helpers" do | ||
ActionView::Base.send :include, SeoHelper | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module SeoHelper | ||
VERSION = "0.0.1" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- encoding: utf-8 -*- | ||
require File.expand_path('../lib/seo_helper/version', __FILE__) | ||
|
||
Gem::Specification.new do |gem| | ||
gem.authors = ["xdite"] | ||
gem.email = ["xdite@techbang.com.tw"] | ||
gem.description = %q{SEO helper of Techbang} | ||
gem.summary = %q{SEO helper of Techbang} | ||
gem.homepage = "" | ||
|
||
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
gem.files = `git ls-files`.split("\n") | ||
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
gem.name = "seo_helper" | ||
gem.require_paths = ["lib"] | ||
gem.version = SeoHelper::VERSION | ||
end |