ikiwiki is not yet able to create a Google sitemap internally, so I'm using google-sitemapgen. To run it automatically when the website is being updated, I've changed the git hook to run it after the ikiwiki hook.
- In the ikiwiki setup file let git_wrapper point to a file which is not the post-update hook, so you're able to run it from your own skript. I'm using /path/to/myikiwiki.git/hooks/post-update.ikiwiki.
- Write a skript which runs as post-update hook and executes the created hook from ikiwiki and google-sitemapgen with a proper configuration. My versions of both files are listed below.
/path/to/myikiwiki.git/hooks/post-update
#!/bin/sh /path/to/myikiwiki.git/hooks/post-update.ikiwiki /usr/bin/google-sitemapgen --config=/path/to/mywikiconfig/sitemap_config.xml exec git-update-server-info
/path/to/mywikiconfig/sitemap_config.xml
<?xml version="1.0" encoding="UTF-8"?> <site base_url="http://bzed.de/" store_into="/path/to/bzed.de/sitemap.xml.gz" verbose="0" suppress_search_engine_notify="0" default_encoding="UTF-8" > <directory path="/path/to/bzed.de" url="http://bzed.de/" default_file="index.html" /> <!-- Exclude URLs that end with a '~' (IE: emacs backup files) --> <filter action="drop" type="wildcard" pattern="*~" /> <!-- Exclude URLs within UNIX-style hidden files or directories --> <filter action="drop" type="regexp" pattern="/\.*" /> <!-- Exclude ikiwiki directories --> <filter action="drop" type="regexp" pattern="/helponformatting/*" /> <filter action="drop" type="regexp" pattern="/ikiwiki/*" /> <filter action="drop" type="regexp" pattern="/markdown/*" /> <filter action="drop" type="regexp" pattern="/openid/*" /> <filter action="drop" type="regexp" pattern="/pagespec/*" /> <filter action="drop" type="regexp" pattern="/preprocessordirective/*" /> <filter action="drop" type="regexp" pattern="/sandbox/*" /> <filter action="drop" type="regexp" pattern="/shortcuts/*" /> <filter action="drop" type="regexp" pattern="/smileys/*" /> <filter action="drop" type="regexp" pattern="/subpage/*" /> <filter action="drop" type="regexp" pattern="/templates/*" /> <filter action="drop" type="regexp" pattern="/theme/*" /> <filter action="drop" type="regexp" pattern="/wikiicons/*" /> <filter action="drop" type="regexp" pattern="/wikilink/*" /> <filter action="drop" type="regexp" pattern="/wmd/*" /> <!-- Exclude css files, favicon and javascript --> <filter action="drop" type="wildcard" pattern="*.css" /> <filter action="drop" type="wildcard" pattern="*favicon.ico" /> <filter action="drop" type="wildcard" pattern="*.js" /> <!-- Exclude ikiwiki.cgi --> <filter action="drop" type="wildcard" pattern="ikiwiki.cgi" /> </site>
See the examples and README files in /usr/share/doc/google-sitemapgen/ for an introduction into configuring google-sitemapgen.
So far the generated sitemaps works very well, especially for search engines which are not able to use the rss feeds like Google does.
