When hosting your site in a CI/CD environment, the step that clones your project repository must perform a deep clone. If the clone is shallow, the Git information for a given file may not be accurate—it may reflect the most recent repository commit, not the commit that last modified the file.
Some providers perform deep clones by default, others allow you to configure the clone depth, and some providers only perform shallow clones.
To configure a Cloudflare Pages site for deep cloning, preface the site’s normal Hugo build command with git fetch --unshallow && (e.g., git fetch --unshallow && hugo). ↩︎
You can configure the GitHub Action to do a deep clone by specifying fetch-depth: 0 in the applicable “checkout” step of your workflow file, as shown in the Hugo documentation’s example workflow file. ↩︎