This is a sample project to get you started building a static website with TakeShape (TS) and Next.js. This project references the same Shape Blog content template as the shape-blog sample project but instead of directly generating the page source using the TakeShape Static Site Generator (SSG), it uses the Next.js framework to create a statically-generated React application.
- Use the "Deploy to TakeShape" button to create the project in TakeShape.
- Set up and run the client application
git clone https://github.com/takeshape/takeshape-samples takeshape-samples && cd takeshape-samples/shape-blog-nextjs
npm install
oryarn
- This will install all dependencies
- In your "Shape Blog" TakeShape project, create a new API Key
- Create a
.env
file in the project root containing values for yourTAKESHAPE_PROJECT
andTAKESHAPE_API_KEY
, such as:
TAKESHAPE_PROJECT="YOUR PROJECT ID HERE"
TAKESHAPE_API_KEY="YOUR API KEY HERE"
npm run dev
oryarn dev
- The server runs on http://localhost:3000 by default- Have fun playing around with the sample site!
- Change some markup a template file and the site will regenerate automatically
- Try adding a new field to an existing content type then add it to the corresponding GraphQL query and template
See the shape-blog README for additional documentation
An easy way to deploy Next.js to production is with ZEIT Now, a platform from the creators of Next.js.
Alternatively you can use the now
CLI.
npm install -g now
You may need to use the now login
command to authenticate your CLI.
Next, add your TakeShape credentials to Now so that it can use them when running your site:
now secrets add takeshape-api-key YOUR-API-KEY
now secrets add takeshape-project YOUR-PROJECT-ID
Then you can deploy using the now
command from the project root:
now
Deploying to Netlify requires the use of the next build
and next export
commands, which are provided in package.json
as export
.
First install the Netlify CLI using npm or Yarn. Using npm:
npm install netlify-cli -g
You may need to use the netlify login
command to authenticate your CLI.
Then, build and export your project:
npm run export
# or
yarn export
Then deploy using the Netlify CLI:
netlify deploy
If we can make your life easier we want to hear from you at [email protected]