Publish Your Gridsome Blog On Netlify

July 31, 2020 · 1 min read

fast biker. background is city lights at night, blurred due to the high speed of biker Photo by Luca Campioni on Unsplash

This is part ten of a series on building a file-based blog from scratch with Gridsome. Find the full series here.

Do you already use Netlify?

It’s an awesome service to host static websites on a fast and global CDN. They also offer functions, forms, identity, DNS, automatic HTTPS, and much more.

What I especially like about Netlify is their website speed (which can give you perfect Lighthouse scores together with JAMStack), and their ease of use. (And they have a very generous free tier.)

Let’s check out how we can set up Netlify with our Gridsome site!

Netlify + Gridsome = 😍

First, you’ll need to make sure you host the repository of your blog somewhere Netlify can access it, e.g. a private GitHub or GitLab repo.

Then, if you don’t already have an account with Netlify, set one up.

If you’re from the EU, you need to sign a Data Processing Agreement with them (see instructions on how to sign their DPA). Their DPA includes the EU standard contractual clause, so you’re safe to use them even after the Schrems II ruling that killed Privacy Shield.

Now, it’s time to add the Netlify configuration to your Gridsome project. Create a file called netlify.toml in the root of your project with the following contents:

[build]
  publish = "dist"
  command = "gridsome build"

Commit and push these changes.

The final step is now to create a new site from Git within Netlify, connect Netlify with your Git hosting service, and select your site’s repository.

Within a few minutes (or less!) your site will be deployed live. You can now add your own domain (for free) and your blog is up and running!

Next part: publish Gridsome blog with Netlify

That’s it for this post on how to publish your Gridsome blog with Netlify. In the next part of this series, we’ll add dark mode to our blog.