Netlify is a great platform with a fluid workflow. Make your changes locally, commit, and push. Netlify takes care of building your site and deploying it atomically. There's so much more that Netlify offers but even for a simple Jamstack site it's well worth checking out.
Branch deploy #
How to configure a custom domain for Netlify branch deploys without using Netlify DNS:
Ensure the branch has deployed successfully
Create DNS record for subdomain matching the branch name, e.g.:
staging 3600 IN CNAME staging--mysite.netlify.app.
Confirm the domain is working, e.g.:
$ nslookup staging.example.com Server: 220.127.116.11 Address: 18.104.22.168#53 Non-authoritative answer: staging.example.com canonical name = staging--mysite.netlify.com. Name: staging--mysite.netlify.com Address: 22.214.171.124
Contact support to get the SSL cert extended to cover the new branch subdomain
More details in a Netlify community post.
Also important to note:
Depending on how you use branch deploys, you may want to prevent them from being indexed by search engines. You can do so by configuring custom headers in your branch.
The first time I read about branch deploys I thought they were what I wanted to preview changes to my site before making it live, but that meant a change to my workflow. Read below for what I actually use.
Deploy previews #
Netlify will automatically build deploy previews for pull requests where the target branch is your production branch or any branch with branch deploys enabled. This means that for a site with a single main branch, you can use deploy previews to validate your changes before they go live, and don't need to manually configure branch deploys or ensure the previews aren't being indexed by search engines. Another point to Netlify! 🏆
More details in the site deploys docs.
Custom domains #
If using Cloudflare DNS with a custom domain, see my DNS tips post for details of CNAME flattening, and ensure Cloudflare is used for DNS only, disable proxying as this doesn't play well with Netlify.
Also see the Netlify docs on configuring external DNS.