-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.txt
74 lines (49 loc) · 2.37 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
BigSitemap
===============
This module was based on the big_sitemap_ ruby gem.
From the gem description:
BigSitemap is a Sitemapgenerator suitable for applications with greater than 50,000 URLs. It splits large Sitemaps into multiple files, gzips the files to minimize bandwidth usage...
Usage
---------
Example::
import bigsitemap
options = {
'gzip': True,
'ping': True,
'base_url': 'http://cdn.mywebsite.com/sitemaps/',
'site_url': 'http://www.mywebsite.com/',
'base_path': '/var/www/cdn/sitemaps'
}
sections = ['/','/boats','/cars','/gadgets','/travel']
places = ['/parents-house.html','/grocery-store.html']
generator = bigsitemap.Generator(options)
for section in sections:
generator.add_url('sections',section,{'last_modified':datetime.now(),'change_frequency':'daily','priority':0.6})
for place in places:
generator.add_url('places',place,{'last_modified':datetime.now(),'change_frequency':'daily','priority':0.6})
generator.finish()
generator.files() #Returns ['sitemap.xml.gz','sections.gz','places.gz']
If your sitemaps grow beyond 50,000 URLs, the sitemap files will be partitioned into multiple files (places_1.xml.gz, places_2.xml.gz, ...).
Initialization Options
----------------------
* gzip: Use gzip? Default **False**.
* ping: Ping google and bing on finish? Default **False**.
* base_path: Where to store the sitemap files? **required**
* site_url: What is your website url? **required**
* base_url: If you store the xml files into another host, supply it here. Default **site_url**.
Change Frequency, Priority and Last Modified
--------------------------------------------
You can control `changefreq <http://www.sitemaps.org/protocol.html#changefreqdef>`_, `priority <http://www.sitemaps.org/protocol.html#prioritydef>`_ and `lastmod <http://www.sitemaps.org/protocol.html#lastmoddef>`_ values for each record individually by passing them as optional arguments when adding URLs::
generator.add_url('sections',section,{
'last_modified':datetime.now(),
'change_frequency':'daily',
'priority':0.6
})
TODO
-----
- Writer class for dependency injection
- Automated tests
Credits
-------
Many thanks to Stateless Systems (statelesssystems.com) for releasing the big_sitemap_ ruby gem.
.. _big_sitemap: https://rubygems.org/gems/big_sitemap