Deploying your Eleventy site to Netlify

This guide will cover the steps on how you can deploy your site built with Eleventy and Agility CMS to Netlify.

Deploying your Eleventy site to Netlify

Setting Up Production Domain in Agility

Updating The Eleventy site when Content is Published

Deploying your Eleventy site to Netlify

Sign in to your Netlify account, or Sign Up if you don't already have one. Then, create a New Site from Git. Choose the Git provider where your site’s source code is hosted.

Screen_Shot_2021-05-19_at_1.12.01_PM.png

Search for the Eleventy site you wish to deploy.

Screen_Shot_2021-05-19_at_1.18.41_PM.png

Ensure the build command is running npm run build

Screen_Shot_2021-05-20_at_11.26.38_AM.png

Be sure to click "Show Advanced" to show the option of adding and defining environment variables, the environment variables you'll need to add are as followed:

# get these values from the API Keys page in Agility Settings => https://manager.agilitycms.com/settings/apikeys

# Your Instance Id
AGILITY_GUID=XXX

# Your Live API Key
AGILITY_API_FETCH_KEY=XXX

# Your Preview API Key
AGILITY_API_PREVIEW_KEY=XXX

# The Locale You'd Like To Source Content From (Default en-us) => https://help.agilitycms.com/hc/en-us/articles/360056925351-Introduction-to-Locales
AGILITY_LANGUAGE_CODE=en-us

# The Name of the Sitemap You'd Like To Source Content From (Default website) => https://help.agilitycms.com/hc/en-us/articles/360055329632
AGILITY_CHANNEL_NAME=website

# This tells Netlify to use Node version 14 or above
NODE_VERSION=14

When the site is deployed, you'll notice the site with its Published Content.

Screen_Shot_2021-05-20_at_11.35.17_AM.png

Setting Up Production Domain in Agility

Once you have your Production Deployment set up on Netlify, we can set up the domain Netlify provides as the Production Domain in Agility CMS.

Learn how to customize your domain in Netlify

Screen_Shot_2021-05-20_at_11.37.28_AM.png

In Agility CMS, head to Settings > Sitemaps, and set up a new Custom Deployment.

Screen_Shot_2021-05-20_at_11.07.49_AM.png

Give your deployment a Name, enter the URL, and set it as the Production Deployment then click Save.

Screen_Shot_2021-05-20_at_11.38.59_AM.png

Updating The Eleventy site when Content is Published

To update your Production deployment when Content is Published, we'll need to set up a Webhook to notify Netlify of these changes.

In Netlify, go to Build Settings > Build & Deploy and add a Deploy Hook. Copy the Webhook URL Netlify generates for you.

Screen_Shot_2021-05-20_at_12.52.44_PM.png

In Agility CMS, go to Settings > Web Hooks, and add a new Webhook. Give it a Name, and paste the Webhook URL Netlify generated for you. Make sure "Receive Content Publish Events" is Checked. You can test the webhook by sending a Test Payload.

Screen_Shot_2021-05-20_at_11.45.12_AM.png

The Production Deployment of your Eleventy site will now rebuild and update when Publish events are made in Agility!

 

1 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.