Skip to content

Instantly share code, notes, and snippets.

@zerodevx
Last active August 15, 2019 17:02
Show Gist options
  • Save zerodevx/9f71a4530f70d4947747ad170c67cd25 to your computer and use it in GitHub Desktop.
Save zerodevx/9f71a4530f70d4947747ad170c67cd25 to your computer and use it in GitHub Desktop.
Best practice to copy static website files from /build to /public correctly using rsync.
# Works well for static sites - where tooling generates the distribution into a build directory,
# and you want to synchronise this with the public deployment directory.
# Add the --dry-run flag to perform a dry run.
cd <source>
rsync -rlpgoDci --del --exclude=.DS_Store . <destination>
@zerodevx
Copy link
Author

So that when you generate a sitemap.xml on /public, the <lastmod> of files are preserved. So Google knows not to reindex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment