Deploying your Gatsby Drupal Site to Netlify

Parent Feed: 

Start by going to your Gatsby site on the command line and committing all your changes to the Git repo. If you are using command line git, the following commands should get you where you need to be:


git add .
git commit -m “Create base site that pulls content from Drupal”

Now head on over to Github (you could also use Gitlab or Bitbucket), log in, and create a new repository. You will want to add this new repo as an origin for your local Git repository. Something like the following command (replace the Git repo URL with your correct URL).


git remote add origin [email protected]:smthomas/gatsby-tutorial.git
git push -u origin master

Now head over to Netlify.com and create an account if you don’t already have one. You will need to use your Github, Gitlab, or Bitbucket account so it can pull in your Git repository you just created.

Once you are logged in, click the New site from Git button.

New Site from Git button

Select your Git provider

Select Git Provider

Select the team and branch you want to deploy to Netlify. The basic build settings should be able to be left at the default. You can use the Advanced build settings section to create environment variables. An example of this would be to pass in the Drupal username and password that can be used to authenticate with your Drupal site (this would require changes to your gatsby-cofig.js file). Once you are ready, click the Deploy site button.

Deploy settings

By default it will give your site an interesting and occasionally funny name. This name will be part of the domain name your site will be accessible at. Don’t worry, you can use your own custom domain if you want. It will take a few minutes for your site to build. This will depend on the size of your site.

Note: You will need to make sure your Drupal site is publicly available in order for your website to build. If you wanted to use a local copy of your Drupal site then using the Git deployment method will not work.

New Netlify Site

You can now follow the steps to set up a custom domain or click the created url to view your new live Gatsby site!

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web