A sireg HTML report showing two passing routes and a 404 for /about/ in a local preview.
July 2017 2 mins read

sireg

A website can build successfully and still lose a page. Change a permalink pattern or move a section, and the new sitemap quietly drops the old URL. People following a bookmark or an inbound link will still ask for it. I built sireg to check those routes before a release goes live.

Read the sireg documentation

From a test on this site to a CLI

The idea started with a sitemap regression test I wrote for this site in 2016. It fetched my live sitemap, swapped the domain for the staging address, and requested each page. While working on the Mimacom website relaunch, I wanted to run the same check without carrying that test harness from one project to the next. I started sireg in July 2017 and wrote about the first version that November.

Use the live sitemap as the baseline

The live sitemap tells you which URLs your current site publishes. Sireg takes those paths and requests them on a local build, a deploy preview, or a staging server. Here is the check I can run against a local copy of this site served on port 8000.

npx sireg check \
  --sitemap https://www.fabian-kleiser.de/sitemap.xml \
  --origin http://127.0.0.1:8000 \
  --expect-status 200 --max-redirects 0

This site runs that check on every pull request against a fresh Hugo build. A published URL must return HTTP 200 directly, and a failure leaves an HTML report with the URL and response. For a larger site, sireg can check a repeatable sample. You can also supply an explicit URL list for routes you want to check on every run.

Check the URLs you meant to move

Old URLs often disappear from the sitemap on purpose. During a migration, I can declare the redirects I expect and check both the first redirect and where it ends up. That catches a common mistake where an old URL redirects successfully but lands on the homepage instead of the page that replaced it.

Sireg is available on npm and released under the MIT license. The documentation includes a guide to checking a local build and CI/CD examples. The source code and issue tracker are on GitHub.