Use Last Updated at Cloudflare
Issue
Docusaurus can display the "last updated" value by looking at the full git history of the repo while building the site. However, Cloudflare's build pipeline does a shallow clone and the "last updated" value is not accurate.
Solution
To work around this issue, add a build step at Cloudflare to fetch the full git history before the site is built.
- In the Cloudflare dashboard, navigate to Workers & Pages, then open the Pages project.
- In the Settings tab, select Builds & deployments.
- In the Build configuration section, prepend
git fetch --unshallow &&
to the Build command. - Click Save.
The Last Updated value should display correctly after the next deployment.
Example
Assuming that yarn
builds the site, the updated command is:
git fetch --unshallow && yarn build