Creating a google sitemap for ikiwiki

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 [[!format sh """ #!/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 [[!format xml "”"

<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”

"""]]

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.