Module: Sitemapper
- Defined in:
- lib/sitemapper.rb,
lib/sitemapper/map.rb,
lib/sitemapper/helpers.rb,
lib/sitemapper/accessors.rb,
lib/sitemapper/sitemap_xml.rb,
lib/sitemapper/object_mapper.rb,
lib/sitemapper/adapters/rails_adapter.rb
Defined Under Namespace
Modules: Accessors, Adapters, Helpers, ObjectMapper Classes: InvalidMap, Map, SitemapXML
Class Method Summary collapse
- .map ⇒ Object
- .map=(map) ⇒ Object
- .map_index ⇒ Object
- .map_index=(index) ⇒ Object
- .meta_lookup ⇒ Object
-
.meta_lookup=(lookup) ⇒ Object
Define the default meta lookup for objects on
pagehelper. -
.site_root ⇒ Object
Returns the site root (previously defined with site_root=).
-
.site_root=(root) ⇒ Object
Set the site root for the generated URLs.
- .urlfy(url_or_path) ⇒ Object
-
.version ⇒ Object
Get the running version of Sitemapper.
Class Method Details
.map ⇒ Object
21 22 23 |
# File 'lib/sitemapper.rb', line 21 def self.map @map end |
.map=(map) ⇒ Object
17 18 19 |
# File 'lib/sitemapper.rb', line 17 def self.map=(map) @map = map end |
.map_index ⇒ Object
29 30 31 |
# File 'lib/sitemapper.rb', line 29 def self.map_index @map_index end |
.map_index=(index) ⇒ Object
25 26 27 |
# File 'lib/sitemapper.rb', line 25 def self.map_index=(index) @map_index = index end |
.meta_lookup ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/sitemapper.rb', line 67 def self. @meta_lookup || { :desc => [:short_description, :description], :keywords => [:tag_list, :keywords], :title => [:title, :name] } end |
.meta_lookup=(lookup) ⇒ Object
Define the default meta lookup for objects on page helper
lookup is a hash with the following options:
-
:descmethod to look for page description -
:keywordsmethod to look for page keywords -
:titlemethod to look for page title
All these arguments can be an Array, String or Symbol and will be used to lookup a valid method when you call page using something different of a Hash as argument. For example:
<% page(@contact) %>
63 64 65 |
# File 'lib/sitemapper.rb', line 63 def self.(lookup) @meta_lookup = lookup end |
.site_root ⇒ Object
Returns the site root (previously defined with site_root=)
34 35 36 |
# File 'lib/sitemapper.rb', line 34 def self.site_root @@site_root ||= 'http://www.example.com/' end |
.site_root=(root) ⇒ Object
Set the site root for the generated URLs
-
rootis the root, (ex.: www.example.com)
41 42 43 |
# File 'lib/sitemapper.rb', line 41 def self.site_root=(root) @@site_root = root end |
.urlfy(url_or_path) ⇒ Object
45 46 47 |
# File 'lib/sitemapper.rb', line 45 def self.urlfy(url_or_path) url_or_path =~ /^https?:/ ? url_or_path : URI.join(self.site_root, url_or_path) end |
.version ⇒ Object
Get the running version of Sitemapper
13 14 15 |
# File 'lib/sitemapper.rb', line 13 def self.version [MAJOR, MINOR, PATCH].join('.') end |