Netlify CMS & Next.js Series - Deploy

Senior Full-Stack Developer with over 20 years of experience building web applications for startups, government, and higher education.
Search for a command to run...

Senior Full-Stack Developer with over 20 years of experience building web applications for startups, government, and higher education.
No comments yet. Be the first to comment.
This will be a series of posts were I setup a simple brochure site in Next.js driven by the Netlify CMS.
We can now edit data using Netlify CMS, while its functional I'm sure you'll agree its not exactly pretty! Lets add some Tailwind CSS to show a Navbar and a Hero section with a custom preview so it looks as if we're editing the actual page when we'r...
Writing this up so I have somewhere to quickly grab basic Jest setup. This information is copied from the Jest Documentation Site compressed into just the parts I'm interested in. Create folders mkdir -p <project>/src cd <project> Install and init n...

In this blog post, we'll explore the process of setting up and configuring a Postgres database using Docker and seeding it with test data. This approach can be used for a variety of apps and can be easily adapted for your own needs. We'll cover all t...

Continuing from last time, we will explore the concepts behind Create and Update functionality and provide a step-by-step guide on how to implement it in your SvelteKit application. Let's get started! Server & Client Code In SvelteKit, the server-sid...

Introduction In this post, I will explore how to create a REST API using Spring Boot and Kotlin. We will dive into the fundamentals of Spring Boot and Kotlin, explain how to set up the project, and guide you through the process of building the API st...

Introduction Welcome to the latest post in my series of Koan Battles using Kotlin and TypeScript. In this series, we'll complete a Koan in both languages and then discuss the differences between the two solutions. My goal is to help you gain a deeper...

We're finally ready to deploy our site to Netlify!
Make a file at the top level of your directory called netlify.toml, and fill it with:
[build]
command = "npm run build && npm run export"
publish = "out"
The command here is referring to the “Build Command” that Netlify will use to build and bundle up your final site. The publish is referring to the directory in which the build will be located after bundling! Next.js always exports to the out directory unless you configure it otherwise.
Then, open up your package.json and add this to the scripts underneath "start":
"export": "next export"
Amazingly, this is all you need to get your project set up for Netlify! Push your code to a repository on your favourite platform.
A Step-by-Step Guide: Deploying A Static Site or Single-page App | Netlify
When you get to step Build and Deploy settings in the above guide, use the following settings:

Once the deploy is complete we need to enable Netlify Identity service.



All the pieces are now in place and we're finally ready to login to the site.
Check your email for the invite email you sent above. Click the "Accept the invite" link and you will be taken to the deployed site to set a Password using the Netlify Identity Widget:

Enter a secure password and click up the Sign up button.
You should now see a successful login message:

If you now go to the url /admin on the deployed site you should see our custom login page.

Enter the username and password we created above and click the Login button.
You should now see the Admin dashboard.
Congratulations, your CMS is working!
Click the Index Page to edit its content.

You can edit the page content on the left and it will update on the right.
When you're happy click publish and Netlify will start a build and deploy process so you can view your changes live on the site.
