gh-pages-symlink-test icon indicating copy to clipboard operation
gh-pages-symlink-test copied to clipboard

Can symlinks point to files/folders outside of `docs/` when `docs/` is the site root?

Open 1j01 opened this issue 10 months ago • 0 comments

This would be very useful for websites demonstrating a library by including it in a page, without having to store build artifacts in the repo (or copy source code), or keeping a messy repository structure.

Answer: no.

Perhaps they only check out a subtree of the repository in this case, for performance, or perhaps they limit the symlinks for security, without consideration for these use cases.

Workarounds:

  • Keep all website files at the root of the repository.
    • Library code must work without a compilation step.
    • Messy repository structure.
    • Unnecessary files will be deployed.
    • Maintains the simplicity/ergonomics of pushing to deploy.
  • Use the gh-pages npm package to copy everything needed for deployment to a separate branch, and configure that branch as the GitHub Pages source.
    • Supports build artifacts / compilation.
    • Clean/flexible repository structure.
    • Control over exact files to be deployed.
    • Requires additional setup for GitHub Actions to restore the ergonomics of pushing to deploy.

1j01 avatar Apr 18 '24 15:04 1j01