Wordpress with Capistrano and Google Sitemaps plugin

September 9, 2006 Link to post  Permalink

If you use the Wordpress Google Sitemap plugin and you use my non-patented Capistrano deployment scripts for Wordpress, then you’ll need to make some changes for things to work well.

Here’s what to do:

1. Add to the before_symlink task in my deploy.rb file two symlinks for the sitemap files in the shared directory:

1 run "ln -nfs #{deploy_to}/#{shared_dir}/sitemap.xml" \
2    " #{current_release}/public/sitemap.xml"
3  run "ln -nfs #{deploy_to}/#{shared_dir}/sitemap.xml.gz" \
4    " #{current_release}/public/sitemap.xml.gz"

2. Set the Sitemap plugin to generate the files to the /path/to/your/domain/shared/sitemap.xml, instead of the default path. The default path will be the current release directory, and you want to have the sitemap files to persist across Wordpress deployments.

Interesting note: Linux allows a symlink to a file that doesn’t exist, so you don’t have to generate the sitemap.xml file in the shared directory before deploying this update.