sitemap_generator 5.3.1 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CHANGES.md +13 -0
- data/MIT-LICENSE +1 -1
- data/README.md +143 -217
- data/VERSION +1 -1
- data/lib/capistrano/tasks/sitemap_generator.cap +3 -3
- data/lib/sitemap_generator.rb +2 -2
- data/lib/sitemap_generator/adapters/aws_sdk_adapter.rb +42 -29
- data/lib/sitemap_generator/adapters/file_adapter.rb +0 -1
- data/lib/sitemap_generator/adapters/fog_adapter.rb +9 -5
- data/lib/sitemap_generator/adapters/s3_adapter.rb +14 -11
- data/lib/sitemap_generator/adapters/wave_adapter.rb +4 -4
- data/lib/sitemap_generator/application.rb +6 -9
- data/lib/sitemap_generator/core_ext/big_decimal.rb +1 -1
- data/lib/sitemap_generator/interpreter.rb +6 -4
- data/lib/sitemap_generator/link_set.rb +5 -3
- metadata +55 -27
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
OTg0MzFiYjliNzgyYTU5MzU4NzMwMzkyODgzMWVjMWQ4YWJkYjhjYw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bd5273cdd05ca2424e838c1505a796cb7bb55647
|
4
|
+
data.tar.gz: 05cbb2f7268b6631738b8a6be118ae3319f053da
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZjVlODkzNmZkMTZjOGZlNDk3NGY3ZGZiMjg0NzM2YjAwOWViYzQzNzRmNjQ3
|
11
|
-
NDRlOWYyZTM4NmEyY2I5N2UxODVjMDc0MDFjODJjMDYxODMyMjE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NWMyMTZjOWJiOWFlM2UzM2Y0MjRmOWZjOTAxMmJiMjc4MGU5OTEyZDFjYjk3
|
14
|
-
MmY4YjMwYjczMTBkMDkwMGFiMjM2ODVmNDc2MTFiMzM0MDUwYTY4YWQ0ZjZi
|
15
|
-
Y2QzNzg4YWVkOTMwNzVhOTVjYjkxYmQ5Yjg3YTRlYjNiZDE0NWM=
|
6
|
+
metadata.gz: 7c777c3ea4cbecfdaebbd51ae1d0a8179360d88550cb2b37dfe649cc5f3644edf84494f29caa1b1ccddadd5d84281e6fa15906f825c2824c00145c076e06aeb0
|
7
|
+
data.tar.gz: d96685b4029e704e8320936dc74d63db60527f6846bc7aa4682612c254b1c4e89060c85c45b592c4f89d21c12580f815ef2fcedc067a4283ade468888515e388
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
### 6.0.0
|
2
|
+
|
3
|
+
*Backwards incompatible changes*
|
4
|
+
|
5
|
+
* Adapters (AWS SDK, S3, Fog & Wave) no longer load their dependencies. It is up to the user
|
6
|
+
to `require` the appropriate libraries for the adapter to work.
|
7
|
+
* AwsSdkAdapter: Fixed [#279](https://github.com/kjvarga/sitemap_generator/issues/279) where sitemaps were incorrectly nested under a `sitemaps/` directory in S3
|
8
|
+
* Stop supporting Ruby < 2.0, test with Ruby 2.4.
|
9
|
+
|
10
|
+
*Other changes*
|
11
|
+
|
12
|
+
* If Rails is defined but the application is not loaded, don't include the URL helpers.
|
13
|
+
|
1
14
|
### 5.3.1
|
2
15
|
|
3
16
|
* Ensure files have 644 permissions when building to try to address issue [#264](https://github.com/kjvarga/sitemap_generator/issues/264)
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -9,7 +9,7 @@ Sitemaps adhere to the [Sitemap 0.9 protocol][sitemap_protocol] specification.
|
|
9
9
|
* Framework agnostic
|
10
10
|
* Supports [News sitemaps][sitemap_news], [Video sitemaps][sitemap_video], [Image sitemaps][sitemap_images], [Mobile sitemaps][sitemap_mobile], [PageMap sitemaps][sitemap_pagemap] and [Alternate Links][alternate_links]
|
11
11
|
* Supports read-only filesystems like Heroku via uploading to a remote host like Amazon S3
|
12
|
-
* Compatible with
|
12
|
+
* Compatible with all versions of Rails and Ruby
|
13
13
|
* Adheres to the [Sitemap 0.9 protocol][sitemap_protocol]
|
14
14
|
* Handles millions of links
|
15
15
|
* Customizable sitemap compression
|
@@ -59,69 +59,62 @@ Successful ping of Google
|
|
59
59
|
Successful ping of Bing
|
60
60
|
```
|
61
61
|
|
62
|
-
##
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
* [Deprecation Notices and Non-Backwards Compatible Changes](#deprecation-notices-and-non-backwards-compatible-changes)
|
119
|
-
* [Version 5.0.0](#version-500)
|
120
|
-
* [Version 4.0.0](#version-400)
|
121
|
-
* [So what has changed?](#so-what-has-changed)
|
122
|
-
* [I don't want it! How can I keep everything as it was?](#i-dont-want-it--how-can-i-keep-everything-as-it-was)
|
123
|
-
* [I want it! What do I need to do?](#i-want-it--what-do-i-need-to-do)
|
124
|
-
* [Thanks (in no particular order)](#thanks-in-no-particular-order)
|
62
|
+
## Contents
|
63
|
+
|
64
|
+
* [Features](#features)
|
65
|
+
+ [Show Me](#show-me)
|
66
|
+
* [Contents](#contents)
|
67
|
+
* [Contribute](#contribute)
|
68
|
+
* [Foreword](#foreword)
|
69
|
+
* [Installation](#installation)
|
70
|
+
+ [Ruby](#ruby)
|
71
|
+
+ [Rails](#rails)
|
72
|
+
* [Getting Started](#getting-started)
|
73
|
+
+ [Preventing Output](#preventing-output)
|
74
|
+
+ [Rake Tasks](#rake-tasks)
|
75
|
+
+ [Pinging Search Engines](#pinging-search-engines)
|
76
|
+
+ [Crontab](#crontab)
|
77
|
+
+ [Robots.txt](#robotstxt)
|
78
|
+
+ [Ruby Modules](#ruby-modules)
|
79
|
+
+ [Deployments & Capistrano](#deployments--capistrano)
|
80
|
+
+ [Sitemaps with no Index File](#sitemaps-with-no-index-file)
|
81
|
+
+ [Upload Sitemaps to a Remote Host using Adapters](#upload-sitemaps-to-a-remote-host-using-adapters)
|
82
|
+
- [Supported Adapters](#supported-adapters)
|
83
|
+
- [An Example of Using an Adapter](#an-example-of-using-an-adapter)
|
84
|
+
+ [Generating Multiple Sitemaps](#generating-multiple-sitemaps)
|
85
|
+
* [Sitemap Configuration](#sitemap-configuration)
|
86
|
+
+ [A Simple Example](#a-simple-example)
|
87
|
+
+ [Adding Links](#adding-links)
|
88
|
+
+ [Supported Options to `add`](#supported-options-to-add)
|
89
|
+
+ [Adding Links to the Sitemap Index](#adding-links-to-the-sitemap-index)
|
90
|
+
+ [Accessing the LinkSet instance](#accessing-the-linkset-instance)
|
91
|
+
+ [Speeding Things Up](#speeding-things-up)
|
92
|
+
* [Customizing your Sitemaps](#customizing-your-sitemaps)
|
93
|
+
+ [Sitemap Options](#sitemap-options)
|
94
|
+
* [Sitemap Groups](#sitemap-groups)
|
95
|
+
+ [A Groups Example](#a-groups-example)
|
96
|
+
+ [Using `group` without a block](#using-group-without-a-block)
|
97
|
+
* [Sitemap Extensions](#sitemap-extensions)
|
98
|
+
+ [News Sitemaps](#news-sitemaps)
|
99
|
+
- [Example](#example)
|
100
|
+
- [Supported options](#supported-options)
|
101
|
+
+ [Image Sitemaps](#image-sitemaps)
|
102
|
+
- [Example](#example-1)
|
103
|
+
- [Supported options](#supported-options-1)
|
104
|
+
+ [Video Sitemaps](#video-sitemaps)
|
105
|
+
- [Example](#example-2)
|
106
|
+
- [Supported options](#supported-options-2)
|
107
|
+
+ [PageMap Sitemaps](#pagemap-sitemaps)
|
108
|
+
- [Supported options](#supported-options-3)
|
109
|
+
- [Example:](#example)
|
110
|
+
+ [Alternate Links](#alternate-links)
|
111
|
+
- [Example](#example-3)
|
112
|
+
- [Supported options](#supported-options-4)
|
113
|
+
+ [Mobile Sitemaps](#-mobile-sitemaps)
|
114
|
+
- [Example](#example-4)
|
115
|
+
- [Supported options](#supported-options-5)
|
116
|
+
* [Compatibility](#compatibility)
|
117
|
+
* [Licence](#licence)
|
125
118
|
|
126
119
|
## Contribute
|
127
120
|
|
@@ -139,7 +132,7 @@ Those who knew him know what an amazing guy he was, and what an excellent Rails
|
|
139
132
|
The canonical repository is: [http://github.com/kjvarga/sitemap_generator][canonical_repo]
|
140
133
|
|
141
134
|
|
142
|
-
##
|
135
|
+
## Installation
|
143
136
|
|
144
137
|
### Ruby
|
145
138
|
|
@@ -157,7 +150,7 @@ The Rake tasks expect your sitemap to be at `config/sitemap.rb` but if you need
|
|
157
150
|
|
158
151
|
### Rails
|
159
152
|
|
160
|
-
SitemapGenerator works
|
153
|
+
SitemapGenerator works with all versions of Rails and has been tested in Rails 2, 3 and 4.
|
161
154
|
|
162
155
|
Add the gem to your `Gemfile`:
|
163
156
|
|
@@ -171,19 +164,6 @@ Alternatively, if you are not using a `Gemfile` add the gem to your `config/envi
|
|
171
164
|
config.gem 'sitemap_generator'
|
172
165
|
```
|
173
166
|
|
174
|
-
|
175
|
-
**Rails 1 or 2 only**, add the following code to your `Rakefile` to include the gem's Rake tasks in your project (Rails 3 does this for you automatically, so this step is not necessary):
|
176
|
-
|
177
|
-
```ruby
|
178
|
-
begin
|
179
|
-
require 'sitemap_generator/tasks'
|
180
|
-
rescue Exception => e
|
181
|
-
puts "Warning, couldn't load gem tasks: #{e.message}! Skipping..."
|
182
|
-
end
|
183
|
-
```
|
184
|
-
|
185
|
-
_If you would prefer to install as a plugin (deprecated) don't do any of the above. Simply run `script/plugin install git://github.com/kjvarga/sitemap_generator.git` from your application root directory._
|
186
|
-
|
187
167
|
## Getting Started
|
188
168
|
|
189
169
|
### Preventing Output
|
@@ -198,14 +178,23 @@ SitemapGenerator.verbose = false
|
|
198
178
|
|
199
179
|
### Rake Tasks
|
200
180
|
|
201
|
-
* `rake sitemap:install` will create a `config/sitemap.rb` file which is your sitemap configuration
|
202
|
-
|
203
|
-
|
181
|
+
* `rake sitemap:install` will create a `config/sitemap.rb` file which is your sitemap configuration
|
182
|
+
and contains everything needed to build your sitemap. See
|
183
|
+
[**Sitemap Configuration**](#sitemap-configuration) below for more information about how to
|
184
|
+
define your sitemap.
|
204
185
|
|
186
|
+
* `rake sitemap:refresh` will create or rebuild your sitemap files as needed. Sitemaps are
|
187
|
+
generated into the `public/` folder and by default are named `sitemap.xml.gz`, `sitemap1.xml.gz`,
|
188
|
+
`sitemap2.xml.gz`, etc. As you can see, they are automatically GZip compressed for you. In this case,
|
189
|
+
`sitemap.xml.gz` is your sitemap "index" file.
|
190
|
+
|
191
|
+
`rake sitemap:refresh` will output information about each sitemap that is written including its
|
192
|
+
location, how many links it contains, and the size of the file.
|
205
193
|
|
206
194
|
### Pinging Search Engines
|
207
195
|
|
208
|
-
Using `rake sitemap:refresh` will notify
|
196
|
+
Using `rake sitemap:refresh` will notify Google and Bing to let them know that a new sitemap
|
197
|
+
is available. To generate new sitemaps without notifying search engines, use `rake sitemap:refresh:no_ping`.
|
209
198
|
|
210
199
|
If you want to customize the hash of search engines you can access it at:
|
211
200
|
|
@@ -213,24 +202,27 @@ If you want to customize the hash of search engines you can access it at:
|
|
213
202
|
SitemapGenerator::Sitemap.search_engines
|
214
203
|
```
|
215
204
|
|
216
|
-
Usually you would be adding a new search engine to ping. In this case you can modify
|
205
|
+
Usually you would be adding a new search engine to ping. In this case you can modify
|
206
|
+
the `search_engines` hash directly. This ensures that when
|
207
|
+
`SitemapGenerator::Sitemap.ping_search_engines` is called, your new search engine will be included.
|
217
208
|
|
218
|
-
If you are calling `ping_search_engines` manually
|
209
|
+
If you are calling `ping_search_engines` manually, then you can pass your new search engine
|
210
|
+
directly in the call, as in the following example:
|
219
211
|
|
220
212
|
```ruby
|
221
|
-
SitemapGenerator::Sitemap.ping_search_engines(:
|
213
|
+
SitemapGenerator::Sitemap.ping_search_engines(newengine: 'http://newengine.com/ping?url=%s')
|
222
214
|
```
|
223
215
|
|
224
|
-
The key gives the name of the search engine as a string or symbol and the value is the full URL to ping with a string interpolation that will be replaced by the CGI escaped sitemap index URL. If you have any literal percent characters in your URL you need to escape them with `%%`.
|
216
|
+
The key gives the name of the search engine, as a string or symbol, and the value is the full URL to ping, with a string interpolation that will be replaced by the CGI escaped sitemap index URL. If you have any literal percent characters in your URL you need to escape them with `%%`.
|
225
217
|
|
226
|
-
If you are calling `SitemapGenerator::Sitemap.ping_search_engines` from outside of your sitemap config file then you will need to set `SitemapGenerator::Sitemap.default_host` and any other options that you set in your sitemap config which affect the location of the sitemap index file. For example:
|
218
|
+
If you are calling `SitemapGenerator::Sitemap.ping_search_engines` from outside of your sitemap config file, then you will need to set `SitemapGenerator::Sitemap.default_host` and any other options that you set in your sitemap config which affect the location of the sitemap index file. For example:
|
227
219
|
|
228
220
|
```ruby
|
229
221
|
SitemapGenerator::Sitemap.default_host = 'http://example.com'
|
230
222
|
SitemapGenerator::Sitemap.ping_search_engines
|
231
223
|
```
|
232
224
|
|
233
|
-
Alternatively you can pass in the full URL to your sitemap index in which case we would have just the following:
|
225
|
+
Alternatively, you can pass in the full URL to your sitemap index, in which case we would have just the following:
|
234
226
|
|
235
227
|
```ruby
|
236
228
|
SitemapGenerator::Sitemap.ping_search_engines('http://example.com/sitemap.xml.gz')
|
@@ -249,7 +241,6 @@ every 1.day, :at => '5:00 am' do
|
|
249
241
|
end
|
250
242
|
```
|
251
243
|
|
252
|
-
|
253
244
|
### Robots.txt
|
254
245
|
|
255
246
|
You should add the URL of the sitemap index file to `public/robots.txt` to help search engines find your sitemaps. The URL should be the complete URL to the sitemap index. For example:
|
@@ -260,13 +251,15 @@ Sitemap: http://www.example.com/sitemap.xml.gz
|
|
260
251
|
|
261
252
|
### Ruby Modules
|
262
253
|
|
263
|
-
If you need to include a module (e.g. a rails helper) you
|
254
|
+
If you need to include a module (e.g. a rails helper), you must include it in the sitemap interpreter
|
255
|
+
class. The part of your sitemap configuration that defines your sitemaps is run within an instance
|
256
|
+
of the `SitemapGenerator::Interpreter`:
|
264
257
|
|
265
258
|
```ruby
|
266
259
|
SitemapGenerator::Interpreter.send :include, RoutingHelper
|
267
260
|
```
|
268
261
|
|
269
|
-
|
262
|
+
### Deployments & Capistrano
|
270
263
|
|
271
264
|
To include the capistrano tasks just add the following to your Capfile:
|
272
265
|
|
@@ -274,6 +267,12 @@ To include the capistrano tasks just add the following to your Capfile:
|
|
274
267
|
require 'capistrano/sitemap_generator'
|
275
268
|
```
|
276
269
|
|
270
|
+
Configurable options:
|
271
|
+
|
272
|
+
```ruby
|
273
|
+
set :sitemap_roles, :web # default
|
274
|
+
```
|
275
|
+
|
277
276
|
Available capistrano tasks:
|
278
277
|
|
279
278
|
```ruby
|
@@ -319,41 +318,67 @@ SitemapGenerator::Sitemap.create_index = :auto
|
|
319
318
|
|
320
319
|
_This section needs better documentation. Please consider contributing._
|
321
320
|
|
321
|
+
Sometimes it is desirable to host your sitemap files on a remote server, and point robots
|
322
|
+
and search engines to the remote files. For example, if you are using a host like Heroku,
|
323
|
+
which doesn't allow writing to the local filesystem. You still require *some* write access,
|
324
|
+
because the sitemap files need to be written out before uploading. So generally a host will
|
325
|
+
give you write access to a temporary directory. On Heroku this is `tmp/` within your application
|
326
|
+
directory.
|
327
|
+
|
322
328
|
#### Supported Adapters
|
329
|
+
|
323
330
|
* `SitemapGenerator::FileAdapter`
|
324
331
|
|
325
|
-
Standard adapter, writes out to a file
|
332
|
+
Standard adapter, writes out to a file.
|
326
333
|
|
327
334
|
* `SitemapGenerator::FogAdapter`
|
328
335
|
|
329
|
-
Uses `
|
336
|
+
Uses `Fog::Storage` to upload to any service supported by Fog.
|
337
|
+
|
338
|
+
You must `require 'fog'` in your sitemap config before using this adapter,
|
339
|
+
or `require` another library that defines `Fog::Storage`.
|
330
340
|
|
331
341
|
* `SitemapGenerator::S3Adapter`
|
332
342
|
|
333
|
-
Uses `
|
343
|
+
Uses `Fog::Storage` to upload to Amazon S3 storage.
|
344
|
+
|
345
|
+
You must `require 'fog-aws'` in your sitemap config before using this adapter.
|
334
346
|
|
335
347
|
* `SitemapGenerator::AwsSdkAdapter`
|
336
348
|
|
337
|
-
Uses `
|
349
|
+
Uses `Aws::S3::Resource` to upload to Amazon S3 storage. Includes automatic detection of your AWS
|
350
|
+
credentials using `Aws::Credentials`.
|
351
|
+
|
352
|
+
You must `require 'aws-sdk'` in your sitemap config before using this adapter,
|
353
|
+
or `require` another library that defines `Aws::S3::Resource` and `Aws::Credentials`.
|
354
|
+
|
355
|
+
An example of using this adapter in your sitemap configuration:
|
356
|
+
|
357
|
+
```ruby
|
358
|
+
SitemapGenerator::Sitemap.adapter = SitemapGenerator::AwsSdkAdapter.new('s3_bucket',
|
359
|
+
aws_access_key_id: 'AKIAI3SW5CRAZBL4WSTA',
|
360
|
+
aws_secret_access_key: 'asdfadsfdsafsadf',
|
361
|
+
aws_region: 'us-east-1'
|
362
|
+
)
|
363
|
+
```
|
338
364
|
|
339
365
|
* `SitemapGenerator::WaveAdapter`
|
340
366
|
|
341
|
-
Uses `
|
367
|
+
Uses `CarrierWave::Uploader::Base` to upload to any service supported by CarrierWave, for example,
|
368
|
+
Amazon S3, Rackspace Cloud Files, and MongoDB's GridF.
|
342
369
|
|
343
|
-
|
370
|
+
You must `require 'carrierwave'` in your sitemap config before using this adapter,
|
371
|
+
or `require` another library that defines `CarrierWave::Uploader::Base`.
|
344
372
|
|
345
|
-
|
346
|
-
and search engines to the remote files. For example if you are using a host like Heroku
|
347
|
-
which doesn't allow writing to the local filesystem. You still require *some* write access
|
348
|
-
because the sitemap files need to be written out before uploading, so generally a host will
|
349
|
-
give you write access to a temporary directory. On Heroku this is `tmp/` in your application
|
350
|
-
directory.
|
373
|
+
Some documentation exists [on the wiki page][remote_hosts].
|
351
374
|
|
352
|
-
|
375
|
+
#### An Example of Using an Adapter
|
353
376
|
|
354
|
-
1. Please see [this wiki page][remote_hosts] for more information about setting up
|
377
|
+
1. Please see [this wiki page][remote_hosts] for more information about setting up SitemapGenerator to upload to a
|
378
|
+
remote host.
|
355
379
|
|
356
|
-
2.
|
380
|
+
2. This example uses the CarrierWave adapter. It shows some common settings that are used when the hostname hosting
|
381
|
+
the sitemaps differs from the hostname of the sitemap links.
|
357
382
|
|
358
383
|
```ruby
|
359
384
|
# Your website's host name
|
@@ -368,14 +393,14 @@ Sitemap Generator uses CarrierWave to support uploading to Amazon S3 store, Rack
|
|
368
393
|
# Set this to a directory/path if you don't want to upload to the root of your `sitemaps_host`
|
369
394
|
SitemapGenerator::Sitemap.sitemaps_path = 'sitemaps/'
|
370
395
|
|
371
|
-
#
|
396
|
+
# The adapter to perform the upload of sitemap files.
|
372
397
|
SitemapGenerator::Sitemap.adapter = SitemapGenerator::WaveAdapter.new
|
373
398
|
```
|
374
399
|
|
375
400
|
3. Update your `robots.txt` file to point robots to the remote sitemap index file, e.g:
|
376
401
|
|
377
402
|
```
|
378
|
-
Sitemap: http://s3.amazonaws.com/sitemap-generator/sitemaps/
|
403
|
+
Sitemap: http://s3.amazonaws.com/sitemap-generator/sitemaps/sitemap.xml.gz
|
379
404
|
```
|
380
405
|
|
381
406
|
You generate your sitemaps as usual using `rake sitemap:refresh`.
|
@@ -386,9 +411,10 @@ Sitemap Generator uses CarrierWave to support uploading to Amazon S3 store, Rack
|
|
386
411
|
in the sitemap, something that the sitemap rules forbid. (Since version 3.2 this is no
|
387
412
|
longer an issue because [`include_index` is off by default][include_index_change].)
|
388
413
|
|
389
|
-
4. Verify to
|
414
|
+
4. Verify to Google that you own the S3 url
|
390
415
|
|
391
|
-
In order for Google to use your sitemap, you need to prove you own the
|
416
|
+
In order for Google to use your sitemap, you need to prove you own the S3 bucket through [google webmaster tools](https://www.google.com/webmasters/tools/home?hl=en). In the example above, you would add the site `http://s3.amazonaws.com/sitemap-generator/sitemaps`. Once you have verified you own the directory, then add your
|
417
|
+
sitemap index to the list of sitemaps for the site.
|
392
418
|
|
393
419
|
### Generating Multiple Sitemaps
|
394
420
|
|
@@ -467,7 +493,6 @@ If you want to use a non-standard configuration file, or have multiple configura
|
|
467
493
|
rake sitemap:refresh CONFIG_FILE="config/geo_sitemap.rb"
|
468
494
|
```
|
469
495
|
|
470
|
-
|
471
496
|
### A Simple Example
|
472
497
|
|
473
498
|
So what does a sitemap configuration look like? Let's take a look at a simple example:
|
@@ -1058,117 +1083,18 @@ end
|
|
1058
1083
|
|
1059
1084
|
* `:mobile` - Presence of this option will turn on the mobile flag regardless of value.
|
1060
1085
|
|
1061
|
-
## Raison d'être
|
1062
|
-
|
1063
|
-
Most of the Sitemap plugins out there seem to try to recreate the Sitemap links by iterating the Rails routes. In some cases this is possible, but for a great deal of cases it isn't.
|
1064
|
-
|
1065
|
-
a) There are probably quite a few routes in your routes file that don't need inclusion in the Sitemap. (AJAX routes I'm looking at you.)
|
1066
|
-
|
1067
|
-
and
|
1068
|
-
|
1069
|
-
b) How would you infer the correct series of links for the following route?
|
1070
|
-
|
1071
|
-
```ruby
|
1072
|
-
map.zipcode 'location/:state/:city/:zipcode', :controller => 'zipcode', :action => 'index'
|
1073
|
-
```
|
1074
|
-
|
1075
|
-
Don't tell me it's trivial, because it isn't. It just looks trivial.
|
1076
|
-
|
1077
|
-
So my idea is to have another file similar to 'routes.rb' called 'sitemap.rb', where you can define what goes into the Sitemap.
|
1078
|
-
|
1079
|
-
Here's my solution:
|
1080
|
-
|
1081
|
-
```ruby
|
1082
|
-
Zipcode.find(:all, :include => :city).each do |z|
|
1083
|
-
add zipcode_path(:state => z.city.state, :city => z.city, :zipcode => z)
|
1084
|
-
end
|
1085
|
-
```
|
1086
|
-
|
1087
|
-
Easy hey?
|
1088
|
-
|
1089
1086
|
## Compatibility
|
1090
1087
|
|
1091
|
-
|
1092
|
-
|
1093
|
-
* **Rails** 3.0.0, 3.0.7, 4.2.3
|
1094
|
-
* **Rails** 1.x - 2.3.8
|
1095
|
-
* **Ruby** 1.8.6, 1.8.7, 1.8.7 Enterprise Edition, 1.9.1, 1.9.2, 2.1.3
|
1096
|
-
|
1097
|
-
|
1098
|
-
## Known Bugs
|
1099
|
-
|
1100
|
-
* There's no check on the size of a URL which [isn't supposed to exceed 2,048 bytes][sitemaps_xml].
|
1101
|
-
* Currently only supports one Sitemap Index file, which can contain 50,000 Sitemap files which can each contain 50,000 urls, so it _only_ supports up to 2,500,000,000 (2.5 billion) urls.
|
1102
|
-
|
1103
|
-
|
1104
|
-
## Deprecation Notices and Non-Backwards Compatible Changes
|
1105
|
-
|
1106
|
-
### Version 5.0.0
|
1107
|
-
|
1108
|
-
In version 5.0.0 I've removed a few deprecated methods that have been deprecated for a long time. The reason being that they would have made some new features more difficult and complex to implement. I never actually ouput deprecation notices from these methods, so I understand it you're a little annoyed that your config has suddenly broken. Apologies.
|
1109
|
-
|
1110
|
-
Here's a list of the methods that have been removed:
|
1111
|
-
* Removed options to `LinkSet::add()`: `:sitemaps_namer` and `:sitemap_index_namer` (use `:namer` option)
|
1112
|
-
* Removed `LinkSet::sitemaps_namer=`, `LinkSet::sitemaps_namer` (use `LinkSet::namer=` and `LinkSet::namer`)
|
1113
|
-
* Removed `LinkSet::sitemaps_index_namer=`, `LinkSet::sitemaps_index_namer` (use `LinkSet::namer=` and `LinkSet::namer`)
|
1114
|
-
* Removed the `SitemapGenerator::SitemapNamer` class (use `SitemapGenerator::SimpleNamer`)
|
1115
|
-
* Removed `LinkSet::add_links()` (use `LinkSet::create()`)
|
1116
|
-
|
1117
|
-
### Version 4.0.0
|
1118
|
-
|
1119
|
-
Version 4.0 introduces a new **non-backwards compatible** naming scheme. **If you are running version 3 or earlier and you upgrade to version 4, you need to make a couple small changes to ensure that search engines can still find your sitemaps!** Your sitemaps will still work fine, but the name of the index file has changed.
|
1120
|
-
|
1121
|
-
#### So what has changed?
|
1122
|
-
|
1123
|
-
* **The index is generated intelligently**. SitemapGenerator now detects whether you need an index or not, and only generates one if you need it or have requested it. So small sites (less than 50,000 links) won't have one, large sites will. You don't have to worry about anything. And with the `create_index` option, it's easier than ever to control index creation to suit your needs.
|
1124
|
-
|
1125
|
-
* **The default index file name has changed** from `sitemap_index.xml.gz` to just `sitemap.xml.gz`. So the `_index` part has been removed. This is a more standard naming scheme for the sitemaps. Any further sitemaps are named `sitemap1.xml.gz`, `sitemap2.xml.gz`, `sitemap3.xml.gz` etc, just as before.
|
1126
|
-
|
1127
|
-
* **Everyone now points search engines to the `sitemap.xml.gz` file**. It doesn't matter whether your site has 10 links or a million links, just point to `sitemap.xml.gz`. If your site needs an index, that is the index. If it doesn't, then that's your sitemap. Simple.
|
1128
|
-
|
1129
|
-
* **It's easier to write custom namers** because the index and the sitemaps share the same namer instance (which is now a `SitemapGenerator::SimpleNamer` instance).
|
1130
|
-
|
1131
|
-
* **Groups share the new naming convention**. So the files in your `geo` group will be named `geo.xml.gz`, `geo1.xml.gz`, `geo2.xml.gz` etc. Pre-version 4 these files would have been named `geo1.xml.gz`, `geo2.xml.gz`, `geo3.xml.gz` etc.
|
1132
|
-
|
1133
|
-
#### I don't want it! How can I keep everything as it was?
|
1134
|
-
|
1135
|
-
You don't care, you just want to get on with your day. To resort to pre-version 4 behaviour add the following to your sitemap config:
|
1136
|
-
|
1137
|
-
```ruby
|
1138
|
-
SitemapGenerator::Sitemap.create_index = true
|
1139
|
-
SitemapGenerator::Sitemap.namer = SitemapGenerator::SimpleNamer.new(:sitemap, :zero => '_index')
|
1140
|
-
```
|
1141
|
-
|
1142
|
-
This tells SitemapGenerator to always create an index file and to name it `sitemap_index.xml.gz`. If you are already using custom namers, you don't need to set `namer`; your old namers should still work as before. If you are using named groups, setting the sitemap namer in this way won't affect your groups, which will still be using the new naming scheme. If this is an issue for you, you may have to create namers for your groups.
|
1143
|
-
|
1144
|
-
#### I want it! What do I need to do?
|
1145
|
-
|
1146
|
-
1. Update your `robots.txt` file and make sure it points to `sitemap.xml.gz`.
|
1147
|
-
2. Generate your sitemaps to create the new `sitemap.xml.gz` file.
|
1148
|
-
3. Optionally remove the old `sitemap_index.xml.gz` file (or link it to the new file if you want to make sure that search engines can find it while you update them.)
|
1149
|
-
4. Go to your Google Webmaster tools and other places where you've pointed search engines to your sitemaps and point them to your new `sitemap.xml.gz` file.
|
1150
|
-
|
1151
|
-
That's it! Welcome to the future!
|
1152
|
-
|
1153
|
-
## Thanks (in no particular order)
|
1088
|
+
Compatible with all versions of Rails and Ruby.
|
1089
|
+
Ruby 1.9.3 support was dropped in Version 6.0.0 of this gem.
|
1154
1090
|
|
1155
|
-
|
1091
|
+
## Licence
|
1156
1092
|
|
1157
|
-
|
1093
|
+
Released under the MIT License. See the (MIT-LICENSE)[MIT-LICENSE] file.
|
1158
1094
|
|
1159
|
-
|
1160
|
-
* [Rodrigo Flores](https://github.com/rodrigoflores) for News sitemaps
|
1161
|
-
* [Alex Soto](http://github.com/apsoto) for Video sitemaps
|
1162
|
-
* [Alexadre Bini](http://github.com/alexandrebini) for Image sitemaps
|
1163
|
-
* [Dan Pickett](http://github.com/dpickett)
|
1164
|
-
* [Rob Biedenharn](http://github.com/rab)
|
1165
|
-
* [Richie Vos](http://github.com/jerryvos)
|
1166
|
-
* [Adrian Mugnolo](http://github.com/xymbol)
|
1167
|
-
* [Jason Weathered](http://github.com/jasoncodes)
|
1168
|
-
* [Andy Stewart](http://github.com/airblade)
|
1169
|
-
* [Brian Armstrong](https://github.com/barmstrong) for Geo sitemaps
|
1095
|
+
MIT. See the LICENSE.md file.
|
1170
1096
|
|
1171
|
-
Copyright (c)
|
1097
|
+
Copyright (c) Karl Varga released under the MIT license
|
1172
1098
|
|
1173
1099
|
[canonical_repo]:http://github.com/kjvarga/sitemap_generator
|
1174
1100
|
[enterprise_class]:https://twitter.com/dhh/status/1631034662 "I use enterprise in the same sense the Phusion guys do - i.e. Enterprise Ruby. Please don't look down on my use of the word 'enterprise' to represent being a cut above. It doesn't mean you ever have to work for a company the size of IBM. Or constantly fight inertia, writing crappy software, adhering to change management practices and spending hours in meetings... Not that there's anything wrong with that - Wait, what?"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
6.0.0
|
@@ -1,7 +1,7 @@
|
|
1
1
|
namespace :sitemap do
|
2
2
|
desc 'Create sitemap and ping search engines'
|
3
3
|
task :refresh do
|
4
|
-
on roles :web do
|
4
|
+
on roles fetch(:sitemap_roles, :web) do
|
5
5
|
within release_path do
|
6
6
|
with rails_env: (fetch(:rails_env) || fetch(:stage)) do
|
7
7
|
execute :rake, "sitemap:refresh"
|
@@ -12,7 +12,7 @@ namespace :sitemap do
|
|
12
12
|
|
13
13
|
desc 'Create sitemap without pinging search engines'
|
14
14
|
task :create do
|
15
|
-
on roles :web do
|
15
|
+
on roles fetch(:sitemap_roles, :web) do
|
16
16
|
within release_path do
|
17
17
|
with rails_env: (fetch(:rails_env) || fetch(:stage)) do
|
18
18
|
execute :rake, "sitemap:create"
|
@@ -23,7 +23,7 @@ namespace :sitemap do
|
|
23
23
|
|
24
24
|
desc 'Clean up sitemaps in sitemap_generator path'
|
25
25
|
task :clean do
|
26
|
-
on roles :web do
|
26
|
+
on roles fetch(:sitemap_roles, :web) do
|
27
27
|
within release_path do
|
28
28
|
with rails_env: (fetch(:rails_env) || fetch(:stage)) do
|
29
29
|
execute :rake, "sitemap:clean"
|
data/lib/sitemap_generator.rb
CHANGED
@@ -26,7 +26,7 @@ module SitemapGenerator
|
|
26
26
|
MAX_SITEMAP_LINKS = 50_000 # max links per sitemap
|
27
27
|
MAX_SITEMAP_IMAGES = 1_000 # max images per url
|
28
28
|
MAX_SITEMAP_NEWS = 1_000 # max news sitemap per index_file
|
29
|
-
MAX_SITEMAP_FILESIZE =
|
29
|
+
MAX_SITEMAP_FILESIZE = 50_000_000 # bytes
|
30
30
|
SCHEMAS = {
|
31
31
|
'image' => 'http://www.google.com/schemas/sitemap-image/1.1',
|
32
32
|
'mobile' => 'http://www.google.com/schemas/sitemap-mobile/1.0',
|
@@ -82,4 +82,4 @@ module SitemapGenerator
|
|
82
82
|
self.app = SitemapGenerator::Application.new
|
83
83
|
end
|
84
84
|
|
85
|
-
require 'sitemap_generator/railtie' if SitemapGenerator.app.
|
85
|
+
require 'sitemap_generator/railtie' if SitemapGenerator.app.is_at_least_rails3?
|
@@ -1,45 +1,58 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
raise LoadError.new("Missing required 'aws-sdk'. Please 'gem install "\
|
5
|
-
"aws-sdk' and require it in your application, or "\
|
6
|
-
"add: gem 'aws-sdk' to your Gemfile.")
|
1
|
+
if !defined?(Aws::S3::Resource) or !defined?(Aws::Credentials)
|
2
|
+
raise "Error: `Aws::S3::Resource` and/or `Aws::Credentials` are not defined.\n\n"\
|
3
|
+
"Please `require 'aws-sdk'` - or another library that defines these classes."
|
7
4
|
end
|
8
5
|
|
9
6
|
module SitemapGenerator
|
10
|
-
# Class for uploading
|
7
|
+
# Class for uploading sitemaps to an S3 bucket using the AWS SDK gem.
|
11
8
|
class AwsSdkAdapter
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
|
9
|
+
# Specify your AWS bucket name, credentials, and/or region. By default
|
10
|
+
# the AWS SDK will auto-detect your credentials and region, but you can use
|
11
|
+
# the following options to configure - or override - them manually:
|
12
|
+
#
|
13
|
+
# Options:
|
14
|
+
# :aws_access_key_id [String] Your AWS access key id
|
15
|
+
# :aws_secret_access_key [String] Your AWS secret access key
|
16
|
+
# :aws_region [String] Your AWS region
|
17
|
+
#
|
18
|
+
# Requires Aws::S3::Resource and Aws::Credentials to be defined.
|
19
|
+
#
|
20
|
+
# @param [String] bucket Name of the S3 bucket
|
21
|
+
# @param [Hash] options AWS credential overrides, see above
|
22
|
+
def initialize(bucket, options = {})
|
19
23
|
@bucket = bucket
|
20
|
-
|
21
|
-
@
|
22
|
-
@aws_region =
|
23
|
-
@aws_secret_access_key = opts[:aws_secret_access_key] || ENV['AWS_SECRET_ACCESS_KEY']
|
24
|
-
|
25
|
-
@path = opts[:path] || 'sitemaps/'
|
24
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
25
|
+
@aws_secret_access_key = options[:aws_secret_access_key]
|
26
|
+
@aws_region = options[:aws_region]
|
26
27
|
end
|
27
28
|
|
28
29
|
# Call with a SitemapLocation and string data
|
29
30
|
def write(location, raw_data)
|
30
31
|
SitemapGenerator::FileAdapter.new.write(location, raw_data)
|
32
|
+
s3_object = s3_resource.bucket(@bucket).object(location.path_in_public)
|
33
|
+
s3_object.upload_file(location.path,
|
34
|
+
acl: 'public-read',
|
35
|
+
cache_control: 'private, max-age=0, no-cache',
|
36
|
+
content_type: location[:compress] ? 'application/x-gzip' : 'application/xml'
|
37
|
+
)
|
38
|
+
end
|
31
39
|
|
32
|
-
|
33
|
-
s3 = Aws::S3::Resource.new(credentials: credentials, region: @aws_region)
|
40
|
+
private
|
34
41
|
|
35
|
-
|
36
|
-
|
42
|
+
def s3_resource
|
43
|
+
@s3_resource ||= Aws::S3::Resource.new(s3_resource_options)
|
44
|
+
end
|
37
45
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
46
|
+
def s3_resource_options
|
47
|
+
options = {}
|
48
|
+
options[:region] = @aws_region if !@aws_region.nil?
|
49
|
+
if !@aws_access_key_id.nil? && !@aws_secret_access_key.nil?
|
50
|
+
options[:credentials] = Aws::Credentials.new(
|
51
|
+
@aws_access_key_id,
|
52
|
+
@aws_secret_access_key
|
53
|
+
)
|
54
|
+
end
|
55
|
+
options
|
43
56
|
end
|
44
57
|
end
|
45
58
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module SitemapGenerator
|
2
2
|
# Class for writing out data to a file.
|
3
3
|
class FileAdapter
|
4
|
-
|
5
4
|
# Write data to a file.
|
6
5
|
# @param location - File object giving the full path and file name of the file.
|
7
6
|
# If the location specifies a directory(ies) which does not exist, the directory(ies)
|
@@ -1,12 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
raise LoadError.new("Missing required 'fog'. Please 'gem install fog' and require it in your application.")
|
1
|
+
if !defined?(Fog::Storage)
|
2
|
+
raise "Error: `Fog::Storage` is not defined.\n\n"\
|
3
|
+
"Please `require 'fog'` - or another library that defines this class."
|
5
4
|
end
|
6
5
|
|
7
6
|
module SitemapGenerator
|
7
|
+
# Class for uploading sitemaps to a Fog supported endpoint.
|
8
8
|
class FogAdapter
|
9
|
-
|
9
|
+
# Requires Fog::Storage to be defined.
|
10
|
+
#
|
11
|
+
# @param [Hash] opts Fog configuration options
|
12
|
+
# @option :fog_credentials [Hash] Credentials for connecting to the remote server
|
13
|
+
# @option :fog_directory [String] Your AWS S3 bucket or similar directory name
|
10
14
|
def initialize(opts = {})
|
11
15
|
@fog_credentials = opts[:fog_credentials]
|
12
16
|
@fog_directory = opts[:fog_directory]
|
@@ -1,17 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
require 'fog/core/services_mixin' rescue nil
|
5
|
-
|
6
|
-
begin
|
7
|
-
require 'fog/storage'
|
8
|
-
rescue LoadError
|
9
|
-
raise LoadError.new("Missing required 'fog-aws'. Please 'gem install fog-aws' and require it in your application.")
|
1
|
+
if !defined?(Fog::Storage)
|
2
|
+
raise "Error: `Fog::Storage` is not defined.\n\n"\
|
3
|
+
"Please `require 'fog-aws'` - or another library that defines this class."
|
10
4
|
end
|
11
5
|
|
12
6
|
module SitemapGenerator
|
7
|
+
# Class for uploading sitemaps to an S3 bucket using the Fog gem.
|
13
8
|
class S3Adapter
|
14
|
-
|
9
|
+
# Requires Fog::Storage to be defined.
|
10
|
+
#
|
11
|
+
# @param [Hash] opts Fog configuration options
|
12
|
+
# @option :aws_access_key_id [String] Your AWS access key id
|
13
|
+
# @option :aws_secret_access_key [String] Your AWS secret access key
|
14
|
+
# @option :fog_provider [String]
|
15
|
+
# @option :fog_directory [String]
|
16
|
+
# @option :fog_region [String]
|
17
|
+
# @option :fog_path_style [String]
|
18
|
+
# @option :fog_storage_options [Hash] Other options to pass to `Fog::Storage`
|
15
19
|
def initialize(opts = {})
|
16
20
|
@aws_access_key_id = opts[:aws_access_key_id] || ENV['AWS_ACCESS_KEY_ID']
|
17
21
|
@aws_secret_access_key = opts[:aws_secret_access_key] || ENV['AWS_SECRET_ACCESS_KEY']
|
@@ -46,6 +50,5 @@ module SitemapGenerator
|
|
46
50
|
:public => true
|
47
51
|
)
|
48
52
|
end
|
49
|
-
|
50
53
|
end
|
51
54
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
raise LoadError.new("Missing required 'carrierwave'. Please 'gem install carrierwave' and require it in your application.")
|
1
|
+
if !defined?(::CarrierWave::Uploader::Base)
|
2
|
+
raise "Error: `CarrierWave::Uploader::Base` is not defined.\n\n"\
|
3
|
+
"Please `require 'carrierwave'` - or another library that defines this class."
|
5
4
|
end
|
6
5
|
|
7
6
|
module SitemapGenerator
|
7
|
+
# Class for uploading sitemaps to a remote server using the CarrierWave gem.
|
8
8
|
class WaveAdapter < ::CarrierWave::Uploader::Base
|
9
9
|
attr_accessor :store_dir
|
10
10
|
|
@@ -2,15 +2,15 @@ require 'pathname'
|
|
2
2
|
|
3
3
|
module SitemapGenerator
|
4
4
|
class Application
|
5
|
-
def
|
5
|
+
def is_rails?
|
6
6
|
!!defined?(Rails::VERSION)
|
7
7
|
end
|
8
8
|
|
9
9
|
# Returns a boolean indicating whether this environment is Rails 3
|
10
10
|
#
|
11
11
|
# @return [Boolean]
|
12
|
-
def
|
13
|
-
|
12
|
+
def is_at_least_rails3?
|
13
|
+
is_rails? && Rails.version.to_f >= 3
|
14
14
|
rescue
|
15
15
|
false # Rails.version defined in 2.1.0
|
16
16
|
end
|
@@ -27,12 +27,9 @@ module SitemapGenerator
|
|
27
27
|
#
|
28
28
|
# @return [String, nil]
|
29
29
|
def rails_root
|
30
|
-
if defined?(::Rails.root)
|
31
|
-
return ::Rails.root.to_s if ::Rails.root
|
32
|
-
raise "ERROR: Rails.root is nil!"
|
33
|
-
end
|
30
|
+
return ::Rails.root.to_s if defined?(::Rails.root) && ::Rails.root
|
34
31
|
return RAILS_ROOT.to_s if defined?(RAILS_ROOT)
|
35
|
-
|
32
|
+
nil
|
36
33
|
end
|
37
34
|
|
38
35
|
# Returns the environment of the Rails application,
|
@@ -43,7 +40,7 @@ module SitemapGenerator
|
|
43
40
|
def rails_env
|
44
41
|
return ::Rails.env.to_s if defined?(::Rails.env)
|
45
42
|
return RAILS_ENV.to_s if defined?(RAILS_ENV)
|
46
|
-
|
43
|
+
nil
|
47
44
|
end
|
48
45
|
end
|
49
46
|
end
|
@@ -19,7 +19,7 @@ class SitemapGenerator::BigDecimal < BigDecimal
|
|
19
19
|
#
|
20
20
|
# Note that reconstituting YAML floats to native floats may lose precision.
|
21
21
|
def to_yaml(opts = {})
|
22
|
-
return super
|
22
|
+
return super unless defined?(YAML::ENGINE) && YAML::ENGINE.syck?
|
23
23
|
|
24
24
|
YAML.quick_emit(nil, opts) do |out|
|
25
25
|
string = to_s
|
@@ -6,9 +6,11 @@ module SitemapGenerator
|
|
6
6
|
# and API methods available to it.
|
7
7
|
class Interpreter
|
8
8
|
|
9
|
-
if SitemapGenerator.app.
|
10
|
-
|
11
|
-
|
9
|
+
if SitemapGenerator.app.is_at_least_rails3?
|
10
|
+
if !::Rails.application.nil?
|
11
|
+
include ::Rails.application.routes.url_helpers
|
12
|
+
end
|
13
|
+
elsif SitemapGenerator.app.is_rails?
|
12
14
|
require 'action_controller'
|
13
15
|
include ActionController::UrlWriter
|
14
16
|
end
|
@@ -34,7 +36,7 @@ module SitemapGenerator
|
|
34
36
|
def add_to_index(*args)
|
35
37
|
@linkset.add_to_index(*args)
|
36
38
|
end
|
37
|
-
|
39
|
+
|
38
40
|
# Start a new group of sitemaps. Any of the options to SitemapGenerator.new may
|
39
41
|
# be passed. Pass a block with calls to +add+ to add links to the sitemaps.
|
40
42
|
#
|
@@ -217,6 +217,7 @@ module SitemapGenerator
|
|
217
217
|
@sitemap.location.merge!(@group.sitemap_location)
|
218
218
|
if block_given?
|
219
219
|
@group.interpreter.eval(:yield_sitemap => @yield_sitemap || SitemapGenerator.yield_sitemap?, &block)
|
220
|
+
@group.finalize_sitemap!
|
220
221
|
@sitemap.location.merge!(@original_location)
|
221
222
|
end
|
222
223
|
else
|
@@ -430,13 +431,14 @@ module SitemapGenerator
|
|
430
431
|
# Add default links if those options are turned on. Record the fact that we have done so
|
431
432
|
# in an instance variable.
|
432
433
|
def add_default_links
|
434
|
+
@added_default_links = true
|
435
|
+
link_options = { :lastmod => Time.now, :changefreq => 'always', :priority => 1.0 }
|
433
436
|
if include_root?
|
434
|
-
|
437
|
+
add('/', link_options)
|
435
438
|
end
|
436
439
|
if include_index?
|
437
|
-
|
440
|
+
add(sitemap_index, link_options)
|
438
441
|
end
|
439
|
-
@added_default_links = true
|
440
442
|
end
|
441
443
|
|
442
444
|
# Finalize a sitemap by including it in the index and outputting a summary line.
|
metadata
CHANGED
@@ -1,99 +1,127 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sitemap_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Varga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: fog-aws
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: nokogiri
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: webmock
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: aws-sdk-core
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: aws-sdk-s3
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
97
125
|
description: SitemapGenerator is a framework-agnostic XML Sitemap generator written
|
98
126
|
in Ruby with automatic Rails integration. It supports Video, News, Image, Mobile,
|
99
127
|
PageMap and Alternate Links sitemap extensions and includes Rake tasks for managing
|
@@ -147,17 +175,17 @@ require_paths:
|
|
147
175
|
- lib
|
148
176
|
required_ruby_version: !ruby/object:Gem::Requirement
|
149
177
|
requirements:
|
150
|
-
- -
|
178
|
+
- - ">="
|
151
179
|
- !ruby/object:Gem::Version
|
152
180
|
version: '0'
|
153
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
182
|
requirements:
|
155
|
-
- -
|
183
|
+
- - ">="
|
156
184
|
- !ruby/object:Gem::Version
|
157
185
|
version: '0'
|
158
186
|
requirements: []
|
159
187
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.6.
|
188
|
+
rubygems_version: 2.6.14
|
161
189
|
signing_key:
|
162
190
|
specification_version: 4
|
163
191
|
summary: Easily generate XML Sitemaps
|