Applies upstream pull request #1310 https://github.com/getpelican/pelican/pull/1310