I’m looking for some tips when first deploying a site to Netlify and would welcome any advice!
I have a Gatsby site that’s in local development. Most of the site is complete but I’m still waiting on some content to replace placeholder text and images.
I would like to deploy the site asap though, to make sure it’s working correctly while hosted and to run performance checks etc, before eventually getting a new domain name and “officially” launching it.
As I understand it, deploy previews and staging branches only work once the main site is live? So would the best approach be to deploy the main branch onto Netlify, making sure robots.txt is set to disallow all (using gatsby-plugin-robots-txt) to stop the site being indexed by search engines, and once the site is fully complete, allow indexing and set up a sitemap.
All advice, or tips if I’m missing something would be thoroughly appreciated!
The primary thing that people miss is the case on file names and import statements. For example, if you’ve named a file
foo.js you need to import it as
foo.js and not
FOO.js or anything else. The builds might work on local if you’re not using any Linux-based OS, but would fail on Netlify.
The other thing is yeah, you need to block search engines. But, you don’t really need a plugin for that. Just add a
robots.txt in your
static folder with the content:
and you’re done.
Apart from that I’d say, try and keep your build times minimum. Gatsby builds really slowly, but if you can optimise your build process, you can save yourself some build minutes.
Thanks hrishikesh! Okay, great, will set up that robots.txt in static and then see about deployment.
I presume, once the site is ready for “launch”, I can set the robots.txt to allow: / and then create a sitemap once the domain name we want has been purchased?
Once it’s ready to launch, you can just delete the
robots.txt and you’re good to go.
About the sitemap, you can keep a sitemap even now, but because you’re
robots.txt, none of those files will be indexed.
Thanks again hrishkesh! You’ve put me at ease bit nerve wracking putting the site up for potentially all to see when it’s not ready yet!
I can relate. Even after deploying many sites, whenever I have to publish a new website, no matter how much I test it locally, I’m nervous.
Hope it will all be fine for you. Good luck!