Skip to content

Commit 345d97a

Browse files
committed
env check
1 parent c0fc459 commit 345d97a

File tree

2 files changed

+4
-144
lines changed

2 files changed

+4
-144
lines changed

README.md

Lines changed: 2 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -1,145 +1,3 @@
1-
# Agility CMS & Next.js Starter
1+
# Agility CMS Website
22

3-
This is sample Next.js starter site that uses Agility CMS and aims to be a foundation for building sites using Next.js and Agility CMS.
4-
5-
[Live Website Demo](https://agilitycms-nextjs-starter-blog.vercel.app/)
6-
7-
[New to Agility CMS? Sign up for a FREE account](https://agilitycms.com/free)
8-
9-
## 📢 UPDATED FOR NEXT.JS 14 📢
10-
11-
- We have updated this starter for Next.js 14. It is built on top of the [@agility/nextjs](https://www.npmjs.com/package/@agility/nextjs) npm package specialized for app router.
12-
13-
### Caching
14-
15-
There are 2 new env var settings that are used to control caching.
16-
17-
- `AGILITY_FETCH_CACHE_DURATION`
18-
19-
- this setting sets the number of seconds that content items retrieved using the Agility Fetch SDK will be cached as objects.
20-
- Works best to use this with on-demand invalidation. If your hosting environment doesn't support this, set it to `0` to disable caching, or set it to a low value, like `10` seconds.
21-
22-
- `AGILITY_PATH_REVALIDATE_DURATION`
23-
- this value controls the `revalidate` export that will tell next.js how long to cache a particular path segment. Set this to a longer value if you are using on-demand revalidation, and a lower value if not, and if your users expect content changes to be reflected earlier.
24-
25-
Agility will NOT cache anything in preview mode :)
26-
27-
#### On Demand Revalidation
28-
29-
- If you are hosting your site on an environment that supports Next.js on-demand revalidation, then you should be using the `AGILITY_FETCH_CACHE_DURATION` value and actively caching items returned from the SDK.
30-
- the revalidation endpoint example is located at `app/api/revalidate/route.ts` and will revalidate the items based on the tags that are used to cache those object.
31-
- The `lib/cms-content` has examples of how to retrieve content while specifying the cache tags for it.
32-
33-
## Changes
34-
35-
This starter now relies on component based data-fetching.
36-
37-
## About This Starter
38-
39-
- Uses our [`@agility/nextjs`](https://www.npmjs.com/package/@agility/nextjs) package to make getting started with Agility CMS and Next.js easy
40-
- Support for Next.js 14
41-
- Connected to a sample Agility CMS Instance for sample content & pages
42-
- Supports [`next/image`](https://nextjs.org/docs/api-reference/next/image) for image optimization using the `<Image />` component or the next.js `<Image />` component for images that aren't stored in Agility.
43-
- Supports full [Page Management](https://help.agilitycms.com/hc/en-us/articles/360055805831)
44-
- Supports Preview Mode
45-
- Supports the `next/font` package
46-
- Provides a functional structure that dynamically routes each page based on the request, loads Layout Models (Page Templates) dynamically, and also dynamically loads and renders appropriate Agility CMS Components (as React Server Components)
47-
- Supports component level data fetching.
48-
49-
### Tailwind CSS
50-
51-
This starter uses [Tailwind CSS](https://tailwindcss.com/), a simple and lightweight utility-first CSS framework packed with classes that can be composed to build any design, directly in your markup.
52-
53-
### TypeScript
54-
55-
This starter is written in TypeScript, with ESLint.
56-
57-
## Getting Started
58-
59-
To start using the Agility CMS & Next.js Starter, [sign up](https://agilitycms.com/free) for a FREE account and create a new Instance using the Blog Template.
60-
61-
1. Clone this repository
62-
2. Run `npm install` or `yarn install`
63-
3. Rename the `.env.local.example` file to `.env.local`
64-
4. Retrieve your `GUID`, `API Keys (Preview/Fetch)`, and `Security Key` from Agility CMS by going to [Settings > API Keys](https://manager.agilitycms.com/settings/apikeys).
65-
66-
[How to Retrieve your GUID and API Keys from Agility](https://help.agilitycms.com/hc/en-us/articles/360031919212-Retrieving-your-API-Key-s-Guid-and-API-URL-)
67-
68-
## Running the Site Locally
69-
70-
### Development Mode
71-
72-
When running your site in `development` mode, you will see the latest content in real-time from the CMS.
73-
74-
#### yarn
75-
76-
1. `yarn install`
77-
2. `yarn dev`
78-
79-
This will launch the site in development mode, using your preview API key to pull in the latest content from Agility.
80-
81-
#### npm
82-
83-
1. `npm install`
84-
2. `npm run dev`
85-
86-
### Production Mode
87-
88-
When running your site in `production` mode, you will see the published content from Agility.
89-
90-
#### yarn
91-
92-
1. `yarn build`
93-
2. `yarn start`
94-
95-
#### npm
96-
97-
1. `npm run build`
98-
2. `npm run start`
99-
100-
## Accessing Content
101-
102-
You can use the Agility Content Fetch SDK normally - either REST or GraphQL within server components.
103-
104-
## Deploying Your Site
105-
106-
The easiest way to deploy a Next.js website to production is to use [Vercel](https://vercel.com/) from the creators of Next.js, or [Netlify](https:netlify.com). Vercel and Netlify are all-in-one platforms - perfect for Next.js.
107-
108-
## Resources
109-
110-
### Agility CMS
111-
112-
- [Official site](https://agilitycms.com)
113-
- [Documentation](https://agilitycms.com/docs)
114-
115-
### Next.js
116-
117-
- [Official site](https://nextjs.org/)
118-
- [Documentation](https://nextjs.org/docs/getting-started)
119-
120-
### Vercel
121-
122-
- [Official site](https://vercel.com/)
123-
124-
### Netlify
125-
126-
- [Official site](https://netlify.com/)
127-
128-
### Tailwind CSS
129-
130-
- [Official site](http://tailwindcss.com/)
131-
- [Documentation](http://tailwindcss.com/docs)
132-
133-
### Community
134-
135-
- [Official Slack](https://agilitycms.com/join-slack)
136-
- [Blog](https://agilitycms.com/resources/posts)
137-
- [GitHub](https://github.com/agility)
138-
139-
- [LinkedIn](https://www.linkedin.com/company/agilitycms)
140-
- [X](https://x.com/agilitycms)
141-
- [Facebook](https://www.facebook.com/AgilityCMS/)
142-
143-
## Feedback and Questions
144-
145-
If you have feedback or questions about this starter, please use the [Github Issues](https://github.com/agility/agilitycms-nextjs-starter/issues) on this repo, or join our [Community Slack Channel](https://agilitycms.com/join-slack).
3+
Netlify Build Status: [![Netlify Status](https://api.netlify.com/api/v1/badges/bdb02c97-02ae-42c0-ba06-12d00af956ea/deploy-status)](https://app.netlify.com/sites/agility-website-next/deploys)

lib/persistant-cache/getCachedObject.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ interface CachedResponse<T> {
1111

1212
export const getCachedObject = async <T>(key: string, isString?: boolean): Promise<CachedResponse<T> | null> => {
1313

14+
console.log("env", process.env)
15+
1416
const isNetlify = (!!process.env.NETLIFY_BLOBS_CONTEXT)
1517
console.log("isNetlify", isNetlify)
1618

0 commit comments

Comments
 (0)