backported from gh-pages