All Projects → agility → agilitycms-nextjs-starter

agility / agilitycms-nextjs-starter

Licence: other
A 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.

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to agilitycms-nextjs-starter

phuctm97.com
🏚 Home on the Web
Stars: ✭ 41 (+115.79%)
Mutual labels:  tailwind-css, vercel
axiom
Axiom - A Hugo Theme. GitTip: https://gitcoin.co/tip?username=jhauraw
Stars: ✭ 67 (+252.63%)
Mutual labels:  tailwind-css, vercel
react-typescript-hooks-realworld
conduit realworld application with [ React + Typescript + Redux + Hooks ]
Stars: ✭ 20 (+5.26%)
Mutual labels:  vercel
be.camp
Open source website for the beCamp unconference in Charlottesville, VA
Stars: ✭ 16 (-15.79%)
Mutual labels:  headless
apps
daily.dev application suite
Stars: ✭ 253 (+1231.58%)
Mutual labels:  vercel
memento-svelte-electron-typescript
Template to create a desktop app with Svelte, TailwindCSS, Electron and TypeScript (with electron-updater, electron-reload and electron-builder)
Stars: ✭ 27 (+42.11%)
Mutual labels:  tailwind-css
meanOs
Mean Operating System - The first decentralized, artificially intelligent, MEAN.js stack, operating system. Mean OS is the only operating system hosted anonymous using a P2P network and a suite of non-standard in-browser delivery mechanisms. Mean OS proudly supports Brave and Tor, be free!
Stars: ✭ 62 (+226.32%)
Mutual labels:  vercel
TriTan-CMS
TriTan CMS is a developer centric content management framework that allows you to go completely headless or nearly headless. With the mighty TriTan, you can build amazing RESTful applications and robust websites.
Stars: ✭ 19 (+0%)
Mutual labels:  headless
yezz.me
My personal website 🚀
Stars: ✭ 23 (+21.05%)
Mutual labels:  vercel
examples
Enjoy our curated collection of examples and solutions. Use these patterns to build your own robust and scalable applications.
Stars: ✭ 960 (+4952.63%)
Mutual labels:  vercel
dev-cover
🌐 Get and publish your developer portfolio with just your username
Stars: ✭ 155 (+715.79%)
Mutual labels:  vercel
next-sass-starter
Use Sass to start your Next.js app with CSS superpowers!
Stars: ✭ 30 (+57.89%)
Mutual labels:  vercel
benjamincarlson.io
My personal website built with Next.js, Chakra UI, Firebase, and next-mdx-remeote.
Stars: ✭ 102 (+436.84%)
Mutual labels:  vercel
portfolio
My personal portfolio website, proudly built with Next.js, TypeScript and Tailwind
Stars: ✭ 165 (+768.42%)
Mutual labels:  vercel
plasmic
Visual page builder and web design tool for any website or web app tech stack
Stars: ✭ 1,475 (+7663.16%)
Mutual labels:  headless
yearn-comms
Collection of communication, announcements, tweets, newsletters, and other articles about Yearn and a hosted blog for all translation contributors.
Stars: ✭ 16 (-15.79%)
Mutual labels:  vercel
next.js-tailwindcss-template
Opinionated Next.js and TailwindCSS template.
Stars: ✭ 15 (-21.05%)
Mutual labels:  vercel
website
My JAMStack website/blog [Next / MDX / ChakraUI]
Stars: ✭ 51 (+168.42%)
Mutual labels:  vercel
roombelt-activity-map
🗺 Show a map of your active customers to build trust
Stars: ✭ 62 (+226.32%)
Mutual labels:  vercel
cproto
Chrome Debugging client for Python
Stars: ✭ 29 (+52.63%)
Mutual labels:  headless

Agility CMS & Next.js Starter

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.

Live Website Demo

New to Agility CMS? Sign up for a FREE account

One Step Create and Deploy to Vercel

Click below to create this project in Agility CMS and deploy it automatically to Vercel.

Deploy with Vercel

About This Starter

  • Uses our @agility/next package to make getting started with Agility CMS and Next.js easy
  • Connected to a sample Agility CMS Instance for sample content & pages
  • 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)

Tailwind CSS

This 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.

TypeScript

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.

Getting Started

To start using the Agility CMS & Next.js Starter, sign up for a FREE account and create a new Instance using the Blog Template.

  1. Clone this repository
  2. Run npm install or yarn install
  3. Rename the .env.local.example file to .env.local
  4. Retrieve your GUID, 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

Running the Site Locally

Development Mode

When running your site in development mode, you will see the latest content in real-time from the CMS.

yarn

  1. yarn install
  2. yarn dev

To update content locally without restarting your dev server, run yarn cms-pull

To clear your content cache locally, run yarn cms-clear

npm

  1. npm install
  2. npm run dev

To update content locally without restarting your dev server, run npm run cms-pull

To clear your content cache locally, run npm run cms-clear

Production Mode

When running your site in production mode, you will see the published from the CMS.

yarn

  1. yarn build
  2. yarn start

npm

  1. npm run build
  2. npm run start

Accessing Content

Content 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.

getSitemap Parameters

  • 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.

getContentItem Parameters

  • 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.

getContentList Parameters

  • 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.

Deploying Your Site

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.

Deploy with Vercel

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.

Notes

How to Register Page Modules

  1. To create a new Page Module, create a new React component within the /components/agility-pageModules directory.
  2. 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 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 },
];

How to Register Page Templates

  1. To create a new Page Template, create a new React component within the /components/agility-pageTemplates directory.
  2. 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 the allTemplates array:
import MainTemplate from "./MainTemplate";

const allTemplates = [
  { name: "MainTemplate", template: MainTemplate }
];

How to Properly Link to an Internal Page

To link to internal pages, use the next/link component.

import Link from 'next/link';

<Link href="https://github.com/posts">
  <a>{item.fields.title}</a>
</Link>

How to Preview Content

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.

Resources

Agility CMS

Next.js

Vercel

Tailwind CSS

Community

Feedback and Questions

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].