This is sample Next.js starter site that uses Agility CMS and aims to be a foundation for building fully static sites using Next.js and Agility CMS.
New to Agility CMS? Sign up for a FREE account
Click below to create this project in Agility CMS and deploy it automatically to Vercel.
@agility/next package to make getting started with Agility CMS and Next.js easygetStaticProps function from Next.js to allow for full SSG (Static Site Generation)next/image for image optimizationrevalidate tag with Vercel to enable ISR (Incremental Static Regeneration) buildsThis starter uses Tailwind CSS, a simple and lightweight utility-first CSS framework packed with classes that can be composed to build any design, directly in your markup.
It also comes equipped with Autoprefixer, a plugin which use the data based on current browser popularity and property support to apply CSS prefixes for you.
This starter supports TypeScript out of the box. If you would like to use TypeScript in your project, simply rename your files with a .ts extension to start taking advantage of Typescript concepts such as types and interfaces to help describe your data.
To start using the Agility CMS & Next.js Starter, sign up for a FREE account and create a new Instance using the Blog Template.
npm install or yarn install.env.local.example file to .env.localGUID, API Keys (Preview/Fetch), and Security Key from Agility CMS by going to Settings > API Keys.How to Retrieve your GUID and API Keys from Agility
When running your site in development mode, you will see the latest content in real-time from the CMS.
yarn installyarn devTo update content locally without restarting your dev server, run yarn cms-pull
To clear your content cache locally, run yarn cms-clear
npm installnpm run devTo update content locally without restarting your dev server, run npm run cms-pull
To clear your content cache locally, run npm run cms-clear
When running your site in production mode, you will see the published from the CMS.
yarn buildyarn startnpm run buildnpm run startContent get's passed to your Agility Page Modules as props, but you can also use the built in API to access. The API will first try to access the Sync SDK to see if any content is saved locally. If no content is stored locally, the API will fallback to our REST API.
Some common calls to the Sync SDK include: getContentItem, getContentList, and getSitemap.
channelName, string, required - The contentID of the requested item in this locale.languageCode, string, required - The reference name of the Sitemap in Agility to return.contentID, integer, required - The contentID of the requested item in this locale.languageCode, string, required - The locale code you want to retrieve content for.depth, integer - The maximum level to expand linked content from this item (Sync SDK).contentLinkDepth - The maximum level to expand linked content from this item (REST API).expandAllContentLinks, boolean - Whether or not to expand entire linked content references, includings lists and items that are rendered in the CMS as Grid or Link.referenceName, string, required - The unique reference name of the content list you wish to retrieve in the current locale. Reference names must be ALL lowercase.languageCode, string, required - The locale code you want to retrieve content for.depth, integer - The depth of list items (Sync SDK).contentLinkDepth - The maximum level to expand linked content from this item (REST API).expandAllContentLinks, boolean - Whether or not to expand entire linked content references, includings lists and items that are rendered in the CMS as Grid or Link.The easiest way to deploy a Next.js website to production is to use Vercel from the creators of Next.js. Vercel is an all-in-one platform with Global CDN supporting static & Jamstack deployment and Serverless Functions.
By clicking the button above, you can get this starter repo deployed to Vercel with a Preview Environment within minutes! It will prompt you to enter your AGILITY_GUID, AGILITY_API_FETCH_KEY, AGILITY_API_PREVIEW_KEY and your AGILITY_SECURITY_KEY.
/components/agility-pageModules directory.index file within the /components/agility-pageModules directory and added to the allModules array:import RichTextArea from "./RichTextArea"; import FeaturedPost from "./FeaturedPost"; import PostsListing from "./PostsListing"; import PostDetails from "./PostDetails"; import Heading from "./Heading"; import TextBlockWithImage from "./TextBlockWithImage"; const allModules = [ { name: "TextBlockWithImage", module: TextBlockWithImage }, { name: "Heading", module: Heading }, { name: "FeaturedPost", module: FeaturedPost }, { name: "PostsListing", module: PostsListing }, { name: "PostDetails", module: PostDetails }, { name: "RichTextArea", module: RichTextArea }, ];
/components/agility-pageTemplates directory.index file within the /components/agility-pageTemplates directory and added to the allTemplates array:import MainTemplate from "./MainTemplate"; const allTemplates = [ { name: "MainTemplate", template: MainTemplate } ];
To link to internal pages, use the next/link component.
import Link from 'next/link'; <Link href="/posts"> <a>{item.fields.title}</a> </Link>
Since this is a static site, how can editors preview content in real-time as they are making edits within Agility CMS? Vercel supports Previews out of the box! Simply paste the address of your site deployed on Vercel into your Agility Sitemap Configuration (Settings > Sitemaps), and use it as your Preview Deployment.
If you have feedback or questions about this starter, please use the Github Issues on this repo, join our Community Slack Channel or create a post on the Agility Developer Community.
Start a blog with Next.js, AgilityCMS and TailwindCSS.
This is sample Next.js starter site that uses Agility CMS and aims to be a foundation for building fully static sites using Next.js and Agility CMS.
New to Agility CMS? Sign up for a FREE account
Click below to create this project in Agility CMS and deploy it automatically to Vercel.
@agility/next package to make getting started with Agility CMS and Next.js easygetStaticProps function from Next.js to allow for full SSG (Static Site Generation)next/image for image optimizationrevalidate tag with Vercel to enable ISR (Incremental Static Regeneration) buildsThis starter uses Tailwind CSS, a simple and lightweight utility-first CSS framework packed with classes that can be composed to build any design, directly in your markup.
It also comes equipped with Autoprefixer, a plugin which use the data based on current browser popularity and property support to apply CSS prefixes for you.
This starter supports TypeScript out of the box. If you would like to use TypeScript in your project, simply rename your files with a .ts extension to start taking advantage of Typescript concepts such as types and interfaces to help describe your data.
To start using the Agility CMS & Next.js Starter, sign up for a FREE account and create a new Instance using the Blog Template.
npm install or yarn install.env.local.example file to .env.localGUID, API Keys (Preview/Fetch), and Security Key from Agility CMS by going to Settings > API Keys.How to Retrieve your GUID and API Keys from Agility
When running your site in development mode, you will see the latest content in real-time from the CMS.
yarn installyarn devTo update content locally without restarting your dev server, run yarn cms-pull
To clear your content cache locally, run yarn cms-clear
npm installnpm run devTo update content locally without restarting your dev server, run npm run cms-pull
To clear your content cache locally, run npm run cms-clear
When running your site in production mode, you will see the published from the CMS.
yarn buildyarn startnpm run buildnpm run startContent get's passed to your Agility Page Modules as props, but you can also use the built in API to access. The API will first try to access the Sync SDK to see if any content is saved locally. If no content is stored locally, the API will fallback to our REST API.
Some common calls to the Sync SDK include: getContentItem, getContentList, and getSitemap.
channelName, string, required - The contentID of the requested item in this locale.languageCode, string, required - The reference name of the Sitemap in Agility to return.contentID, integer, required - The contentID of the requested item in this locale.languageCode, string, required - The locale code you want to retrieve content for.depth, integer - The maximum level to expand linked content from this item (Sync SDK).contentLinkDepth - The maximum level to expand linked content from this item (REST API).expandAllContentLinks, boolean - Whether or not to expand entire linked content references, includings lists and items that are rendered in the CMS as Grid or Link.referenceName, string, required - The unique reference name of the content list you wish to retrieve in the current locale. Reference names must be ALL lowercase.languageCode, string, required - The locale code you want to retrieve content for.depth, integer - The depth of list items (Sync SDK).contentLinkDepth - The maximum level to expand linked content from this item (REST API).expandAllContentLinks, boolean - Whether or not to expand entire linked content references, includings lists and items that are rendered in the CMS as Grid or Link.The easiest way to deploy a Next.js website to production is to use Vercel from the creators of Next.js. Vercel is an all-in-one platform with Global CDN supporting static & Jamstack deployment and Serverless Functions.
By clicking the button above, you can get this starter repo deployed to Vercel with a Preview Environment within minutes! It will prompt you to enter your AGILITY_GUID, AGILITY_API_FETCH_KEY, AGILITY_API_PREVIEW_KEY and your AGILITY_SECURITY_KEY.
/components/agility-pageModules directory.index file within the /components/agility-pageModules directory and added to the allModules array:import RichTextArea from "./RichTextArea"; import FeaturedPost from "./FeaturedPost"; import PostsListing from "./PostsListing"; import PostDetails from "./PostDetails"; import Heading from "./Heading"; import TextBlockWithImage from "./TextBlockWithImage"; const allModules = [ { name: "TextBlockWithImage", module: TextBlockWithImage }, { name: "Heading", module: Heading }, { name: "FeaturedPost", module: FeaturedPost }, { name: "PostsListing", module: PostsListing }, { name: "PostDetails", module: PostDetails }, { name: "RichTextArea", module: RichTextArea }, ];
/components/agility-pageTemplates directory.index file within the /components/agility-pageTemplates directory and added to the allTemplates array:import MainTemplate from "./MainTemplate"; const allTemplates = [ { name: "MainTemplate", template: MainTemplate } ];
To link to internal pages, use the next/link component.
import Link from 'next/link'; <Link href="/posts"> <a>{item.fields.title}</a> </Link>
Since this is a static site, how can editors preview content in real-time as they are making edits within Agility CMS? Vercel supports Previews out of the box! Simply paste the address of your site deployed on Vercel into your Agility Sitemap Configuration (Settings > Sitemaps), and use it as your Preview Deployment.
If you have feedback or questions about this starter, please use the Github Issues on this repo, join our Community Slack Channel or create a post on the Agility Developer Community.