README.md in xml-sitemap-1.2.2 vs README.md in xml-sitemap-1.3.0

- old
+ new

@@ -1,16 +1,24 @@ -# XmlSitemap +# XmlSitemap [![Build Status](https://secure.travis-ci.org/sosedoff/xml-sitemap.png?branch=master)](http://travis-ci.org/sosedoff/xml-sitemap) -XmlSitemap is a Ruby library that provides an easy way to generate XML sitemaps and indexes. +XmlSitemap is a ruby library that provides an easy way to generate XML sitemaps and indexes. It does not have any web-framework dependencies and could be used in any ruby-based application. ## Installation Install via rubygems: - $ gem install xml-sitemap +``` +gem install xml-sitemap +``` + +Or using latest source code: + +``` +rake install +``` ## Configuration Add gem to your Gemfile and you're ready to go: @@ -34,11 +42,15 @@ m.add 'page3', :priority => 0.2 # Specify last modification date and update frequiency m.add 'page4', :updated => Date.today, :period => :never end +``` +Render map output: + +```ruby # Render the sitemap XML map.render # Render and save XML to the output file map.render_to('/path/to/file.xml') @@ -57,41 +69,53 @@ ```ruby map = XmlSitemap.new('foobar.com') map = XmlSitemap.map('foobar.com') ``` -By default XmlSitemap creates a map with link to homepage of your domain. It's a priority 1.0. Default priority is 0.5. +By default XmlSitemap creates a map with link to homepage of your domain. -List of periods: +Homepage priority is `1.0`. Default page priority is set to `0.5` -- :none, -- :always -- :hourly -- :daily -- :weekly -- :monthly -- :yearly -- :never +List of available update periods: -## XmlSitemap::Map +- `:none` +- `:always` +- `:hourly` +- `:daily` +- `:weekly` +- `:monthly` +- `:yearly` +- `:never` +### Generating Maps + When creating a new map object, you can specify a set of options. ```ruby map = XmlSitemap::Map.new('mydomain.com', options) ``` Available options: -- :secure - Will add all sitemap items with https prefix. *(default: false)* -- :home - Disable homepage autocreation, but you still can do that manually. *(default: true)* -- :root - Force all links to fall under the main domain. You can add full urls (not paths) if set to false. *(default: true)* -- :time - Provide a creation time for the sitemap. (default: current time) -- :group - Group name for sitemap index. *(default: sitemap)* +- `:secure` - Will add all sitemap items with https prefix. *(default: false)* +- `:home` - Disable homepage autocreation, but you still can do that manually. *(default: true)* +- `:root` - Force all links to fall under the main domain. You can add full urls (not paths) if set to false. *(default: true)* +- `:time` - Provide a creation time for the sitemap. (default: current time) +- `:group` - Group name for sitemap index. *(default: sitemap)* -## XmlSitemap::Index +### Render Engines +XmlSitemap has a few different rendering engines. You can select one passing argument to `render` method. + +Available engines: + +- `:string` - Uses plain strings (for performance). Default. +- `:builder` - Uses Builder::XmlMarkup. +- `:nokogiri` - Uses Nokogiri library. Requires `nokogiri` gem. + +### Sitemap Indexes + Regular sitemap does not support more than 50k records, so if you're generating a huge sitemap you need to use XmlSitemap::Index. Index is just a collection of links to all the website's sitemaps. Usage: @@ -99,10 +123,11 @@ ```ruby map = XmlSitemap::Map.new('domain.com') map.add 'page' index = XmlSitemap::Index.new + # or via shortcut index = XmlSitemap.index # Add a map to the index index.add(map) @@ -112,17 +137,12 @@ # Render XML to the output file index.render_to('/path/to/file.xml') ``` -## Authors & Contributors - -- [Dan Sosedoff](https://github.com/sosedoff) (author) -- [Dan Healy](https://github.com/danhealy) - ## License -Copyright © 2010-2011 Dan Sosedoff. +Copyright © 2010-2013 Dan Sosedoff. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. \ No newline at end of file