tophat 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -21
- data/.rspec +3 -0
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/README.md +100 -0
- data/Rakefile +18 -58
- data/lib/tophat/meta.rb +16 -25
- data/lib/tophat/opengraph.rb +11 -12
- data/lib/tophat/robots.rb +4 -6
- data/lib/tophat/stylesheet.rb +32 -28
- data/lib/tophat/title.rb +64 -68
- data/lib/tophat/version.rb +1 -1
- data/lib/tophat.rb +0 -4
- data/spec/spec_helper.rb +43 -0
- data/spec/tophat/meta_helper_spec.rb +64 -0
- data/spec/tophat/opengraph_helper_spec.rb +71 -0
- data/spec/tophat/robots_helper_spec.rb +39 -0
- data/spec/tophat/stylesheet_helper_spec.rb +148 -0
- data/spec/tophat/title_helper_spec.rb +96 -0
- data/spec/tophat_spec.rb +73 -0
- data/tophat.gemspec +23 -65
- metadata +108 -49
- data/README.textile +0 -123
- data/rails/init.rb +0 -1
- data/test/helper.rb +0 -9
- data/test/test_opengraph.rb +0 -88
- data/test/test_robots.rb +0 -54
- data/test/test_tophat.rb +0 -55
- data/test/test_tophat_meta.rb +0 -76
- data/test/test_tophat_stylesheets.rb +0 -119
- data/test/test_tophat_title.rb +0 -103
data/.gitignore
CHANGED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE
CHANGED
data/README.md
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
TopHat
|
2
|
+
======
|
3
|
+
|
4
|
+
TopHat is a set of view helpers to keep your layouts and views DRY.
|
5
|
+
|
6
|
+
Layout Usage
|
7
|
+
------------
|
8
|
+
|
9
|
+
You'll want to add the relevant TopHat helpers to your layouts:
|
10
|
+
|
11
|
+
<head>
|
12
|
+
<%= title :site => "My website" %>
|
13
|
+
<%= keywords :default => "Some default, keywords, that can be overridden" %>
|
14
|
+
<%= description :default => "A description" %>
|
15
|
+
</head>
|
16
|
+
|
17
|
+
View Usage
|
18
|
+
----------
|
19
|
+
|
20
|
+
To set the page title, use the title method to each of your views:
|
21
|
+
|
22
|
+
<% title "My page title" %>
|
23
|
+
|
24
|
+
When rendered, the page title will be included in your view.
|
25
|
+
|
26
|
+
<head>
|
27
|
+
<title>My website | My page title</title>
|
28
|
+
</head>
|
29
|
+
|
30
|
+
Usage Options
|
31
|
+
-------------
|
32
|
+
|
33
|
+
Use these options to customize the title format:
|
34
|
+
|
35
|
+
* :prefix (text between site name and separator)
|
36
|
+
* :separator (text used to separate website name from page title)
|
37
|
+
* :suffix (text between separator and page title)
|
38
|
+
* :lowercase (when true, the page name will be lowercase)
|
39
|
+
* :reverse (when true, the page and site names will be reversed)
|
40
|
+
* :default (default title to use when title is blank)
|
41
|
+
|
42
|
+
And here are a few examples to give you ideas.
|
43
|
+
|
44
|
+
<%= title :separator => "|" %>
|
45
|
+
<%= title :prefix => false, :separator => ":" %>
|
46
|
+
<%= title :lowercase => true %>
|
47
|
+
<%= title :reverse => true, :prefix => false %>
|
48
|
+
<%= title :default => "The ultimate site for Rails" %>
|
49
|
+
|
50
|
+
These options can be set as defaults for your layout, or when setting the title in your views, you can override any of the default settings by passing an optional hash
|
51
|
+
|
52
|
+
<% title "My page title", :lowercase => true, :separator => "~" %>
|
53
|
+
|
54
|
+
Meta Tag Usage
|
55
|
+
--------------
|
56
|
+
|
57
|
+
TopHat also works with keywords and descriptions. In your view, simply declare the keywords and description.
|
58
|
+
|
59
|
+
<% description('You say goodbye, I say hello.') %>
|
60
|
+
<% keywords('John, Paul, George, Ringo') %>
|
61
|
+
|
62
|
+
Keywords can also be passed as an array:
|
63
|
+
|
64
|
+
<% keywords(%w{ John Paul George Ringo }) %>
|
65
|
+
|
66
|
+
Then in your layout, add the keyword and description helpers:
|
67
|
+
|
68
|
+
<%= keywords %>
|
69
|
+
<%= description %>
|
70
|
+
|
71
|
+
which will output the meta-tags:
|
72
|
+
|
73
|
+
<meta name="keywords" content="John, Paul, George, Ringo" />
|
74
|
+
<meta name="description" content="You say goodbye, I say hello." />
|
75
|
+
|
76
|
+
keywords and descriptions can also take a default in the layout:
|
77
|
+
|
78
|
+
<%= keywords :default => 'Yoko, Linda' %>
|
79
|
+
<%= description :default => 'default description if none is passed' %>
|
80
|
+
|
81
|
+
want to merge your default tags with those in your view? just pass merge_default => true
|
82
|
+
|
83
|
+
<%= keywords :default => 'Yoko, Linda', :merge_default => true %>
|
84
|
+
|
85
|
+
|
86
|
+
Note on Patches/Pull Requests
|
87
|
+
-----------------------------
|
88
|
+
|
89
|
+
* Fork the project.
|
90
|
+
* Make your feature addition or bug fix.
|
91
|
+
* Add tests for it. This is important so I don't break it in a
|
92
|
+
future version unintentionally.
|
93
|
+
* Commit, do not mess with rakefile, version, or history.
|
94
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
95
|
+
* Send me a pull request. Bonus points for topic branches.
|
96
|
+
|
97
|
+
Copyright
|
98
|
+
---------
|
99
|
+
|
100
|
+
Copyright (c) 2011 Steve Agalloco. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,59 +1,19 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
gem.add_development_dependency "shoulda", ">= 0"
|
19
|
-
gem.version = TopHat::VERSION
|
20
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
21
|
-
end
|
22
|
-
Jeweler::GemcutterTasks.new
|
23
|
-
rescue LoadError
|
24
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
25
|
-
end
|
26
|
-
|
27
|
-
require 'rake/testtask'
|
28
|
-
Rake::TestTask.new(:test) do |test|
|
29
|
-
test.libs << 'lib' << 'test'
|
30
|
-
test.pattern = 'test/**/test_*.rb'
|
31
|
-
test.verbose = true
|
32
|
-
end
|
33
|
-
|
34
|
-
begin
|
35
|
-
require 'rcov/rcovtask'
|
36
|
-
Rcov::RcovTask.new do |test|
|
37
|
-
test.libs << 'test'
|
38
|
-
test.pattern = 'test/**/test_*.rb'
|
39
|
-
test.verbose = true
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
|
7
|
+
task :default => :spec
|
8
|
+
|
9
|
+
namespace :doc do
|
10
|
+
require 'yard'
|
11
|
+
YARD::Rake::YardocTask.new do |task|
|
12
|
+
task.files = ['lib/**/*.rb']
|
13
|
+
task.options = [
|
14
|
+
'--protected',
|
15
|
+
'--output-dir', 'doc/yard',
|
16
|
+
'--markup', 'markdown',
|
17
|
+
]
|
40
18
|
end
|
41
|
-
|
42
|
-
task :rcov do
|
43
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
task :test => :check_dependencies
|
48
|
-
|
49
|
-
task :default => :test
|
50
|
-
|
51
|
-
require 'rake/rdoctask'
|
52
|
-
Rake::RDocTask.new do |rdoc|
|
53
|
-
version = TopHat::VERSION
|
54
|
-
|
55
|
-
rdoc.rdoc_dir = 'rdoc'
|
56
|
-
rdoc.title = "tophat #{version}"
|
57
|
-
rdoc.rdoc_files.include('README*')
|
58
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
59
|
-
end
|
19
|
+
end
|
data/lib/tophat/meta.rb
CHANGED
@@ -3,51 +3,42 @@ module TopHat
|
|
3
3
|
|
4
4
|
# page descriptions
|
5
5
|
# <meta name="description" content="Description goes here." />
|
6
|
-
def description(options=
|
6
|
+
def description(options={})
|
7
7
|
if options.is_a? String
|
8
8
|
@tophat_description = options
|
9
|
-
|
10
|
-
else
|
11
|
-
options ||= {}
|
12
|
-
options.merge!(:name => 'description')
|
13
9
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
else
|
18
|
-
options.merge!(:content => @tophat_description)
|
19
|
-
end
|
10
|
+
else
|
11
|
+
options[:name] = 'description'
|
12
|
+
options[:content] = @tophat_description || options.delete(:default)
|
20
13
|
|
21
14
|
tag(:meta, options) if options[:content]
|
22
|
-
end
|
15
|
+
end
|
23
16
|
end
|
24
17
|
|
25
18
|
# keywords
|
26
19
|
# <meta name="keywords" content="Keywords go here." />
|
27
|
-
def keywords(options=
|
20
|
+
def keywords(options={})
|
28
21
|
if options.is_a?(String)
|
29
22
|
@tophat_keywords = options
|
30
|
-
|
23
|
+
|
31
24
|
elsif options.is_a?(Array)
|
32
|
-
@
|
33
|
-
|
34
|
-
else
|
35
|
-
options ||= {}
|
36
|
-
options.merge!(:name => 'keywords')
|
25
|
+
@tophat_keywords = options.join(', ')
|
37
26
|
|
27
|
+
else
|
28
|
+
options[:name] = 'keywords'
|
38
29
|
default_keywords = options.delete(:default) || []
|
39
30
|
display_keywords = @tophat_keywords.blank? ? default_keywords : @tophat_keywords
|
40
|
-
|
31
|
+
|
41
32
|
# normalize the keywords
|
42
|
-
default_keywords = default_keywords.is_a?(String) ? default_keywords.split(',
|
43
|
-
display_keywords = display_keywords.is_a?(String) ? display_keywords.split(',
|
44
|
-
|
33
|
+
default_keywords = default_keywords.is_a?(String) ? default_keywords.split(',') : default_keywords
|
34
|
+
display_keywords = display_keywords.is_a?(String) ? display_keywords.split(',') : display_keywords
|
35
|
+
|
45
36
|
# merge keyword arrays if merge is set to true
|
46
37
|
display_keywords += default_keywords if options.delete(:merge_default) == true
|
47
38
|
|
48
|
-
options.merge!(:content => display_keywords.uniq.join(', '))
|
39
|
+
options.merge!(:content => display_keywords.uniq.join(', ').squeeze(' '))
|
49
40
|
tag(:meta, options) if display_keywords.any?
|
50
|
-
end
|
41
|
+
end
|
51
42
|
end
|
52
43
|
end
|
53
44
|
end
|
data/lib/tophat/opengraph.rb
CHANGED
@@ -3,30 +3,30 @@ module TopHat
|
|
3
3
|
|
4
4
|
class OpenGraphGenerator
|
5
5
|
include ActionView::Helpers
|
6
|
-
|
6
|
+
|
7
7
|
def initialize(options={})
|
8
8
|
@app_id = options.delete(:app_id) if options && options.has_key?(:app_id)
|
9
9
|
@admins = options.delete(:admins) if options && options.has_key?(:admins)
|
10
10
|
@graph_data = {}
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def merge(options={})
|
14
14
|
@app_id = options.delete(:app_id) if options && options.has_key?(:app_id)
|
15
15
|
@admins = options.delete(:admins) if options && options.has_key?(:admins)
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def app_id
|
19
19
|
output = @app_id ? tag(:meta, :property => 'fb:app_id', :content => @app_id) : ""
|
20
20
|
output << '\n' unless output.blank?
|
21
21
|
output
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def admins
|
25
25
|
output = @admins ? tag(:meta, :property => 'fb:admins', :content => [*@admins].join(',')) : ""
|
26
26
|
output << '\n' unless output.blank?
|
27
27
|
output
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def render_graph_data
|
31
31
|
output = ""
|
32
32
|
@graph_data.each_pair do |key, value|
|
@@ -35,23 +35,23 @@ module TopHat
|
|
35
35
|
end
|
36
36
|
output
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def type(t)
|
40
40
|
@graph_data ||= {}
|
41
41
|
@graph_data[:type] = t
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
def has_graph_data?
|
45
45
|
@graph_data
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
def method_missing(method, *args, &block) #:nodoc
|
49
49
|
@graph_data ||= {}
|
50
50
|
@graph_data[method] = args.shift
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
def opengraph(options=nil, &block)
|
56
56
|
if options.kind_of? Hash
|
57
57
|
@tophat_open_graph_defaults = options
|
@@ -69,7 +69,6 @@ module TopHat
|
|
69
69
|
output
|
70
70
|
end
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
end
|
74
74
|
end
|
75
|
-
|
data/lib/tophat/robots.rb
CHANGED
@@ -4,16 +4,14 @@ module TopHat
|
|
4
4
|
def noindex(descriptor='robots')
|
5
5
|
tag(:meta, :name => descriptor, :content => 'noindex')
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
def nofollow(descriptor='robots')
|
9
9
|
tag(:meta, :name => descriptor, :content => 'nofollow')
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def canonical(path=nil)
|
13
|
-
if path
|
14
|
-
tag(:link, :rel => 'canonical', :href => path)
|
15
|
-
end
|
13
|
+
tag(:link, :rel => 'canonical', :href => path) if path
|
16
14
|
end
|
17
|
-
|
15
|
+
|
18
16
|
end
|
19
17
|
end
|
data/lib/tophat/stylesheet.rb
CHANGED
@@ -4,7 +4,7 @@ module TopHat
|
|
4
4
|
def ie_5_conditional(operator = nil, &block)
|
5
5
|
ie_conditional(5, operator, &block)
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
def ie_5_5_conditional(operator = nil, &block)
|
9
9
|
ie_conditional(5.5, operator, &block)
|
10
10
|
end
|
@@ -12,70 +12,74 @@ module TopHat
|
|
12
12
|
def ie_6_conditional(operator = nil, &block)
|
13
13
|
ie_conditional(6, operator, &block)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def ie_7_conditional(operator = nil, &block)
|
17
17
|
ie_conditional(7, operator, &block)
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def ie_8_conditional(operator = nil, &block)
|
21
21
|
ie_conditional(8, operator, &block)
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
|
+
def ie_9_conditional(operator = nil, &block)
|
25
|
+
ie_conditional(9, operator, &block)
|
26
|
+
end
|
27
|
+
|
24
28
|
def ie_conditional(version = nil, operator = nil, &block)
|
25
29
|
browser_conditional('IE', version, operator, &block)
|
26
30
|
end
|
27
|
-
|
31
|
+
|
28
32
|
def gecko_conditional(operator = nil, &block)
|
29
33
|
browser_conditional('Gecko', nil, operator, &block)
|
30
34
|
end
|
31
|
-
|
35
|
+
|
32
36
|
def webkit_conditional(operator = nil, &block)
|
33
37
|
browser_conditional('Webkit', nil, operator, &block)
|
34
38
|
end
|
35
|
-
|
39
|
+
|
36
40
|
def mobile_safari_conditional(operator = nil, &block)
|
37
41
|
browser_conditional('SafMob', nil, operator, &block)
|
38
42
|
end
|
39
|
-
|
43
|
+
|
40
44
|
def opera_conditional(operator = nil, &block)
|
41
45
|
browser_conditional('Opera', nil, operator, &block)
|
42
46
|
end
|
43
|
-
|
47
|
+
|
44
48
|
def ie_mac_conditional(operator = nil, &block)
|
45
49
|
browser_conditional('IEMac', nil, operator, &block)
|
46
50
|
end
|
47
|
-
|
51
|
+
|
48
52
|
def konqueror_conditional(operator = nil, &block)
|
49
53
|
browser_conditional('Konq', nil, operator, &block)
|
50
54
|
end
|
51
|
-
|
55
|
+
|
52
56
|
def ie_mobile_conditional(operator = nil, &block)
|
53
57
|
browser_conditional('IEmob', nil, operator, &block)
|
54
58
|
end
|
55
|
-
|
59
|
+
|
56
60
|
def psp_conditional(operator = nil, &block)
|
57
61
|
browser_conditional('PSP', nil, operator, &block)
|
58
62
|
end
|
59
|
-
|
63
|
+
|
60
64
|
def net_front_conditional(operator = nil, &block)
|
61
65
|
browser_conditional('NetF', nil, operator, &block)
|
62
66
|
end
|
63
|
-
|
67
|
+
|
64
68
|
private
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
69
|
+
|
70
|
+
def browser_conditional(browser, version = nil, operator = nil, &block)
|
71
|
+
unless operator.blank?
|
72
|
+
operator = operator.to_s
|
73
|
+
operator = '!' if operator == 'not'
|
74
|
+
operator << " " unless operator == '!'
|
75
|
+
end
|
76
|
+
|
77
|
+
browser_version = version.blank? ? "" : " #{version}"
|
78
|
+
|
79
|
+
output = "<!--[if #{operator}#{browser}#{browser_version}]>\n"
|
80
|
+
output << yield if block_given?
|
81
|
+
output << "\n<![endif]-->"
|
71
82
|
end
|
72
|
-
|
73
|
-
browser_version = version.blank? ? "" : " #{version}"
|
74
|
-
|
75
|
-
output = "<!--[if #{operator}#{browser}#{browser_version}]>\n"
|
76
|
-
output << yield if block_given?
|
77
|
-
output << "\n<![endif]-->"
|
78
|
-
end
|
79
|
-
|
83
|
+
|
80
84
|
end
|
81
85
|
end
|
data/lib/tophat/title.rb
CHANGED
@@ -1,93 +1,89 @@
|
|
1
1
|
module TopHat
|
2
2
|
module TitleHelper
|
3
|
-
|
3
|
+
|
4
4
|
def title(title=nil, options={})
|
5
|
-
if title.is_a? String
|
5
|
+
if title.is_a? String
|
6
6
|
save_tophat_title(title, options)
|
7
7
|
else
|
8
8
|
display_tophat_title(title)
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
private
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
def save_tophat_title(title, options)
|
15
|
+
@tophat_title = title.gsub(/<\/?[^>]*>/, '')
|
16
|
+
@tophat_title_options = options
|
17
|
+
title
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
def display_tophat_title(options={})
|
21
|
+
options ||= {}
|
22
|
+
options = options.merge(@tophat_title_options) unless @tophat_title_options.nil?
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
# Prefix (leading space)
|
25
|
+
if options[:prefix]
|
26
|
+
prefix = options[:prefix]
|
27
|
+
elsif options[:prefix] == false
|
28
|
+
prefix = ''
|
29
|
+
else
|
30
|
+
prefix = ' '
|
31
|
+
end
|
32
32
|
|
33
|
-
|
34
|
-
|
33
|
+
# Separator
|
34
|
+
separator = options[:separator] || ''
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
# site name
|
46
|
-
site_name = options[:site] || ''
|
36
|
+
# Suffix (trailing space)
|
37
|
+
if options[:suffix]
|
38
|
+
suffix = options[:suffix]
|
39
|
+
elsif options[:suffix] == false
|
40
|
+
suffix = ''
|
41
|
+
else
|
42
|
+
suffix = ' '
|
43
|
+
end
|
47
44
|
|
48
|
-
|
49
|
-
|
50
|
-
@tophat_title.downcase! unless @tophat_title.blank?
|
51
|
-
site_name.downcase! unless site_name.blank?
|
52
|
-
end
|
45
|
+
# site name
|
46
|
+
site_name = options[:site] || ''
|
53
47
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
48
|
+
# Lowercase title?
|
49
|
+
if options[:lowercase] == true
|
50
|
+
@tophat_title.downcase! unless @tophat_title.blank?
|
51
|
+
site_name.downcase! unless site_name.blank?
|
52
|
+
end
|
59
53
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
@
|
64
|
-
else
|
65
|
-
@tophat_reverse = true
|
54
|
+
# Default page title
|
55
|
+
if @tophat_title.blank? && options[:default]
|
56
|
+
@tophat_title = options[:default]
|
57
|
+
@tophat_title_defaulted = true
|
66
58
|
end
|
67
|
-
else
|
68
|
-
@tophat_reverse = false
|
69
|
-
end
|
70
59
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
@tophat_title + prefix + separator + suffix + site_name
|
60
|
+
# figure out reversing
|
61
|
+
if options[:reverse] == true
|
62
|
+
if @tophat_title_defaulted
|
63
|
+
@tophat_reserve = options[:reverse_on_default] != false
|
64
|
+
else
|
65
|
+
@tophat_reverse = true
|
66
|
+
end
|
79
67
|
else
|
80
|
-
|
81
|
-
site_name + prefix + separator + suffix + @tophat_title
|
68
|
+
@tophat_reverse = false
|
82
69
|
end
|
83
|
-
|
84
|
-
return content_tag(:title, display_title.strip)
|
85
|
-
end
|
86
70
|
|
71
|
+
# Set website/page order
|
72
|
+
if @tophat_title.blank?
|
73
|
+
# If title is blank, return only website name
|
74
|
+
content_tag :title, site_name if options[:site]
|
75
|
+
else
|
76
|
+
display_title = if @tophat_reverse == true
|
77
|
+
# Reverse order => "Page : Website"
|
78
|
+
@tophat_title + prefix + separator + suffix + site_name
|
79
|
+
else
|
80
|
+
# Standard order => "Website : Page"
|
81
|
+
site_name + prefix + separator + suffix + @tophat_title
|
82
|
+
end
|
87
83
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
84
|
+
return content_tag(:title, display_title.strip)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
alias t title
|
92
88
|
end
|
93
89
|
end
|
data/lib/tophat/version.rb
CHANGED