This is the source code for the Agility Documentation site.
New to Agility CMS? Sign up for a FREE account
- Uses our
@agility/next
package to make getting started with Agility and Next.js easy - Uses the
getStaticProps
function from Next.js to allow for full SSG (Static Site Generation) - Supports
next/image
for image optimization - Supports full Page Management
- Supports Preview Mode
- Uses
revalidate
tag with Vercel to enable ISR (Incremental Static Regeneration) builds - Provides a functional structure that dynamically routes each page based on the request, loads a Page Templates dynamically, and also dynamically loads and renders appropriate Agility CMS Page Modules (as React components)
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.
Supports TypeScript. Not currently being used, but 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 development on this site:
- Clone this repository
- Run
yarn install
- Rename the
.env.local.template
file to.env.local
- Retrieve your
GUID
,API Keys (Preview/Fetch)
, andSecurity Key
from Agility 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 install
yarn dev
When running your site in production
mode, you will see the published from the CMS.
yarn build
yarn start
Content get's passed to your Agility Page Modules as props
, but you can also use the built in API to access. The API uses the REST API.
s
- To create a new Page Module, create a new React component within the
/components/agility-pageModules
directory. - All of the Page Modules that are being used within the site need to be imported into the
index
file within the/components/agility-pageModules
directory and added to theallModules
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 },
];
- To create a new Page Template, create a new React component within the
/components/agility-pageTemplates
directory. - All of the Page Template that are being used within the site need to be imported into the
index
file within the/components/agility-pageTemplates
directory and added to theallTemplates
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.