I have a git repository that has the page I want to deploy (a mkdocs site) in a subfolder.
In that repository, I have a top level CHANGELOG.md file.
I want to include this file in my site. Since mkdocs doesn’t allow relative links outside the documentation directory, I’m using a symlink to the changelog file:
To deploy, I’m using mkdocs/ as the root directory. When I deploy the site on Cloudflare, the deployment fails, because it can’t find the file (Error reading page 'CHANGELOG.md': [Errno 2] No such file or directory: '/opt/buildhome/repo/docs/CHANGELOG.md').
I made a reproduction repository on GitHub at Nerixyz/cf-pages-symlink-repro. There, I included two symlinks in the documentation: baz.md and mkdocs/bar.md. I deployed the repository with the root directory set to mkdocs.
This is the expected behavior when changing the root directory. Cloudflare with “forget” about any files that exist outside of the selected directory. You should have the root directory be set to the root level and have the build command be something like cd mkdocs && mkdocs build with the output directory set to /mkdoc/docs (unless your output directory is different).