Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 107 lines (70 sloc) 4.225 kb
708a68d @alexrabarts Parse README as RDoc
authored
1 = BigSitemap
acfc8f1 @alexrabarts First release
authored
2
aea5939 @alexrabarts Change from BigSitemap.new syntax to new block syntax so that BigSitemap...
authored
3 BigSitemap is a {Sitemap}[http://sitemaps.org] generator suitable for applications with greater than 50,000 URLs. It splits large Sitemaps into multiple files, gzips the files to minimize bandwidth usage, supports increment updates, can be set up with just a few lines of code and is compatible with just about any framework.
acfc8f1 @alexrabarts First release
authored
4
513d8e1 @alexrabarts Tidy up documentation
authored
5 BigSitemap is best run periodically through a Rake/Thor task.
acfc8f1 @alexrabarts First release
authored
6
42c47ab @alexrabarts Add 'sudo' and 'require' instructions to documentation
authored
7 require 'big_sitemap'
8
aea5939 @alexrabarts Change from BigSitemap.new syntax to new block syntax so that BigSitemap...
authored
9 include Rails.application.routes.url_helpers # Allows access to Rails routes
708a68d @alexrabarts Parse README as RDoc
authored
10
aea5939 @alexrabarts Change from BigSitemap.new syntax to new block syntax so that BigSitemap...
authored
11 BigSitemap.generate(:url_options => {:host => 'example.com'}, :document_root => "#{APP_ROOT}/public") do
12 # Add a static page
13 add '/about'
3ab96d2 @alexrabarts Add support for changefreq and priority
authored
14
aea5939 @alexrabarts Change from BigSitemap.new syntax to new block syntax so that BigSitemap...
authored
15 # Add some URLs from your Rails application
16 Post.find(:all).each do |post|
17 add post_path(post)
18 end
4d728a9 @rngtng updated docs
rngtng authored
19
aea5939 @alexrabarts Change from BigSitemap.new syntax to new block syntax so that BigSitemap...
authored
20 # Add some URLs with additional options
21 Product.find(:all).each do |product|
22 add product_path(product), :change_frequency => 'daily', :priority => 0.5
23 end
24 end
acfc8f1 @alexrabarts First release
authored
25
aea5939 @alexrabarts Change from BigSitemap.new syntax to new block syntax so that BigSitemap...
authored
26 The code above will create a minimum of two files:
acfc8f1 @alexrabarts First release
authored
27
513d8e1 @alexrabarts Tidy up documentation
authored
28 1. public/sitemaps/sitemap_index.xml.gz
aea5939 @alexrabarts Change from BigSitemap.new syntax to new block syntax so that BigSitemap...
authored
29 2. public/sitemaps/sitemap.xml.gz
2a2f23a @alexrabarts Make methods chainable
authored
30
aea5939 @alexrabarts Change from BigSitemap.new syntax to new block syntax so that BigSitemap...
authored
31 If your sitemaps grow beyond 50,000 URLs (this limit can be overridden with the <code>:max_per_sitemap</code> option), the sitemap files will be partitioned into multiple files (<code>sitemap_1.xml.gz</code>, <code>sitemap_2.xml.gz</code>, ...).
2a2f23a @alexrabarts Make methods chainable
authored
32
f137a78 @alexrabarts Update documentation
authored
33 === Framework-specific Classes
acfc8f1 @alexrabarts First release
authored
34
f137a78 @alexrabarts Update documentation
authored
35 Use the framework-specific classes to take advantage of built-in shortcuts.
b01d800 @alexrabarts Split Synopsis up into sections
authored
36
59d7b12 @alexrabarts Fix typos in documentation
authored
37 ==== Rails
d601a39 @alexrabarts Tidy up documentation a bit
authored
38
aea5939 @alexrabarts Change from BigSitemap.new syntax to new block syntax so that BigSitemap...
authored
39 <code>BigSiteMapRails</code> deals with setting the <code>:document_root</code> and <code>:url_options</code> initialization options.
4d728a9 @rngtng updated docs
rngtng authored
40
59d7b12 @alexrabarts Fix typos in documentation
authored
41 ==== Merb
f137a78 @alexrabarts Update documentation
authored
42
43 <code>BigSitemapMerb</code> deals with setting the <code>:document_root</code> initialization option.
4d728a9 @rngtng updated docs
rngtng authored
44
513d8e1 @alexrabarts Tidy up documentation
authored
45 == Install
d601a39 @alexrabarts Tidy up documentation a bit
authored
46
513d8e1 @alexrabarts Tidy up documentation
authored
47 Via gem:
acfc8f1 @alexrabarts First release
authored
48
4d728a9 @rngtng updated docs
rngtng authored
49 sudo gem install big_sitemap
b01d800 @alexrabarts Split Synopsis up into sections
authored
50
513d8e1 @alexrabarts Tidy up documentation
authored
51 == Advanced
acfc8f1 @alexrabarts First release
authored
52
f137a78 @alexrabarts Update documentation
authored
53 === Initialization Options
acfc8f1 @alexrabarts First release
authored
54
eba0820 @alexrabarts Fix RDoc formatting
authored
55 * <code>:url_options</code> -- hash with <code>:host</code>, optionally <code>:port</code> and <code>:protocol</code>
59d7b12 @alexrabarts Fix typos in documentation
authored
56 * <code>:base_url</code> -- string alternative to <code>:url_options</code>, e.g. <code>'https://example.com:8080/'</code>
337fc63 @rngtng cleanup: use File.join to concat file path correctly, introduced option ...
rngtng authored
57 * <code>:url_path</code> -- string path_name to sitemaps folder, defaults to <code>:document_path</code>
f137a78 @alexrabarts Update documentation
authored
58 * <code>:document_root</code> -- string
aea5939 @alexrabarts Change from BigSitemap.new syntax to new block syntax so that BigSitemap...
authored
59 * <code>:document_path</code> -- string document path for sitemaps, relative to :document_root, defaults to empty string (putting sitemap files in the document root directory)
337fc63 @rngtng cleanup: use File.join to concat file path correctly, introduced option ...
rngtng authored
60 * <code>:document_full</code> -- string absolute document path to generation folder - defaults to <code>:document_root/:document_path</code>
eba0820 @alexrabarts Fix RDoc formatting
authored
61 * <code>:max_per_sitemap</code> -- <code>50000</code>, which is the limit dictated by Google but can be less
62 * <code>:gzip</code> -- <code>true</code>
63 * <code>:ping_google</code> -- <code>true</code>
64 * <code>:ping_yahoo</code> -- <code>false</code>, needs <code>:yahoo_app_id</code>
d92209c @alexrabarts Use Bing instead of Live/MSN
authored
65 * <code>:ping_bing</code> -- <code>false</code>
d0aa622 @alexrabarts Fix typo in documentation
authored
66 * <code>:ping_ask</code> -- <code>false</code>
4d728a9 @rngtng updated docs
rngtng authored
67 * <code>:partial_update</code> -- <code>false</code>
68
8463d4d @alexrabarts Add support for lambdas when specifying lastmod
authored
69 === Change Frequency, Priority and Last Modified
efec173 @alexrabarts Add lambda support for changefreq and priority
authored
70
aea5939 @alexrabarts Change from BigSitemap.new syntax to new block syntax so that BigSitemap...
authored
71 You can control "changefreq", "priority" and "lastmod" values for each record individually by passing them as optional arguments when adding URLs:
4d728a9 @rngtng updated docs
rngtng authored
72
aea5939 @alexrabarts Change from BigSitemap.new syntax to new block syntax so that BigSitemap...
authored
73 add(product_path(product), {
74 :change_frequency => 'daily',
75 :priority => 0.5,
76 :last_modified => product.updated_at
77 })
4d728a9 @rngtng updated docs
rngtng authored
78
79 === Partial Update
80
aea5939 @alexrabarts Change from BigSitemap.new syntax to new block syntax so that BigSitemap...
authored
81 If you enable <code>:partial_update</code>, the filename will include the id of the first entry. This is perfect to update just the last file with new entries without the need to re-generate files being already there. You must pass the entry's id in when adding the URL. For example:
4d728a9 @rngtng updated docs
rngtng authored
82
aea5939 @alexrabarts Change from BigSitemap.new syntax to new block syntax so that BigSitemap...
authored
83 BigSitemap.generate(:base_url => 'http://example.com', :partial_update => true) do
84 Widget.find_in_batches(:conditions => "id > #{get_last_id}").each do |widget|
85 add widget_path(widget), :id => widget.id
4d728a9 @rngtng updated docs
rngtng authored
86 end
aea5939 @alexrabarts Change from BigSitemap.new syntax to new block syntax so that BigSitemap...
authored
87 end
acfc8f1 @alexrabarts First release
authored
88
475c303 @alexrabarts Allow base URL to be specified as a hash as well as a string and use Rai...
authored
89 == TODO
90
f137a78 @alexrabarts Update documentation
authored
91 Tests for framework-specific components.
475c303 @alexrabarts Allow base URL to be specified as a hash as well as a string and use Rai...
authored
92
513d8e1 @alexrabarts Tidy up documentation
authored
93 == Credits
acfc8f1 @alexrabarts First release
authored
94
95 Thanks to Alastair Brunton and Harry Love, who's work provided a starting point for this library.
96
f137a78 @alexrabarts Update documentation
authored
97 Thanks also to those who have contributed patches:
295f6fa @alexrabarts Update credits
authored
98
af343e9 @alexrabarts Fix RDoc formatting and typo
authored
99 * Mislav Marohnić
100 * Jeff Schoolcraft
fc441f3 @alexrabarts Update credits
authored
101 * Dalibor Nasevic
4d728a9 @rngtng updated docs
rngtng authored
102 * Tobias Bielohlawek (http://www.rngtng.com)
f660ffa @alexrabarts Simplify options handling in `initialize` (thanks Mislav Marohnić for th...
authored
103
513d8e1 @alexrabarts Tidy up documentation
authored
104 == Copyright
acfc8f1 @alexrabarts First release
authored
105
4d728a9 @rngtng updated docs
rngtng authored
106 Copyright (c) 2010 Stateless Systems (http://statelesssystems.com). See LICENSE for details.
Something went wrong with that request. Please try again.