|Version 20 (modified by mitar, 13 months ago) (diff)|
Google sitemap generator
This plugin will produce a site maps XML file suitable for submission to the Google sitemap service. The sitemap is a way to describe your site's content other than depending on a crawler that follows every link. It's suitable for dynamic sites with lots of different URLs for basically the same content.
The maintainer-ship of this plugin for Trac 0.11+ was taken over by martin_s in May 2010. The new Trac 0.11 version was written from scratch, mainly because of great API changes between the Trac versions. This wiki now describes only the 0.11 (and newer branches in the future). The old description for the 0.10 branch? is also available.
The plugin can be configured to notify Google by sending a PING request to their site when content on your trac has changed (Trac 0.10 version only). For now, wiki pages and tickets are supported in the sitemap. Other things like source code and pages produced by other plugins could also be included if requested.
Download the source code into a directory of your choice, open a command line terminal and run this command:
python setup.py install
or use easy_install either on the downloaded source code or the SVN URL:
easy_install <downloaded zip file or dir> # or easy_install http://trac-hacks.org/svn/googlesitemapplugin/0.11
Activate the plugin and, optionally, the automatic notification in your Trac environment by adding this line to the section [component] of <your trac installation dir>/conf/trac.ini or use the IniAdminPlugin:
tracgooglesitemap.plugin = enabled tracgooglesitemap.notify = enabled # optional, notifies Google to reload the sitemap when content has changed
Restart your web- or trac-server.
The following options are supported. They must be placed under a [googlesitemap] section in the configuration file.
- Path of the sitemap relative to the main URL. Default: 'sitemap.xml'.
- Do not include wiki pages created by the listed users. Default: trac (excludes all standard Trac wiki pages).
- Do not include the following wikis. The wildcards '*' and '?' are allowed and have there usual meaning.
- Which realms (i.e. wiki or ticket) to list. Default: wiki,ticket.
- Change frequency for all entries. Valid values: always, hourly, daily, weekly, monthly, yearly, never. Disabled if empty (default).
- Compress sitemap, either by using HTTP gzip content-encoding if the client supports it (Googlebot does) or by requesting the sitemap with a trailing .gz.
- Compression level used: 0 (low/fast) to 9 (high/slow). Default: 6.
The notifier can be told on which action Google should be notified about the sitemap change:
- List of actions on which Google should be notified. The action names are based on the Trac permissions needed to execute the actions. Supported actions are: TICKET_CREATE, TICKET_DELETE, TICKET_MODIFY, WIKI_CREATE, WIKI_DELETE, WIKI_VERSION_DELETE, WIKI_MODIFY, WIKI_RENAME. By default Google will be notified when a ticket or wiki is created or modified, but not when it is deleted. Default: TICKET_CREATE, TICKET_MODIFY, WIKI_CREATE, WIKI_VERSION_DELETE, WIKI_MODIFY, WIKI_RENAME.
Download the zipped source from here.
This is how a sitemap XML could look like:
<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> <url> <loc>http://yourtracurl/tracproject/wiki/WikiStart</loc> <lastmod>2010-11-07T15:37:07Z</lastmod> <changefreq>daily</changefreq> </url> <url> <loc>http://yourtracurl/tracproject/wiki/SomePage</loc> <lastmod>2010-11-07T16:22:35Z</lastmod> <changefreq>daily</changefreq> </url> </urlset>
More about the document format can be found here.
-  by martin_s on 2010-11-24 21:42:18
- Added missing else clause for _fixtime method. This should fix #8152.
-  by martin_s on 2010-08-30 23:57:39
Added encoding meta-comment and declared SVN keywords as unicode to avoid issues with non-english locales.
-  by martin_s on 2010-08-23 13:11:45
Removed outdated variable rev from setup file.