rsnext/examples/cms-tina/README.md
Freddy Montes 15cc88909c
chore(examples): Add dotCMS example (#38214)
<!--
Thanks for opening a PR! Your contribution is much appreciated.
In order to make sure your PR is handled as smoothly as possible we
request that you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

This adds a new example under cms-dotcms/. Is a general-purpose example
that should allow developers to undestand how to use next.js with dotCMS
apis.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [x] The examples guidelines are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)

Co-authored-by: Daniel Esteves <estevesd8@gmail.com>
Co-authored-by: Will Ezell <will@dotcms.com>
Co-authored-by: Arcadio Quintero A <oidacra@gmail.com>
Co-authored-by: Rafael <rjvelazco21@gmail.com>
2022-10-01 15:26:13 +02:00

3.5 KiB

A statically generated blog example using Next.js and TinaCMS

This example showcases Next.js's Static Generation feature using TinaCMS as the CMS and editor.

This boilerplate demonstrates a basic usage and best practices. If you are looking for a more feature rich Tina experience with contextual editing. check out tina-cloud-starter.

Demo

https://cms-tina-example.vercel.app/

How to use

Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:

npx create-next-app --example cms-tina cms-tina-app
yarn create next-app --example cms-tina cms-tina-app
pnpm create next-app --example cms-tina cms-tina-app

Setp 1. Run Next.js in development mode

To get started, no configuration is needed for local development and editing.

npm install
npm run tina-dev

# or

yarn install
yarn tina-dev

Your blog should be up and running on http://localhost:3000! If it doesn't work, post on GitHub discussions.

Step 2. Editing blog posts.

Tina is git backed and uses markdown, JSON or MDX to power websites. To enter edit mode locally you just need to visit http://localhost:3000/admin

You can then select the collection "Blog Posts" and then the content you would like to edit.

Once you hit save, Tina will use our graphQL modify the content on your filesystem.

Step 4. Deploy on Vercel

You can deploy this app to the cloud with Vercel (Documentation).

Deploy Your Local Project

To deploy your local project to Vercel, push it to GitHub. Once you have pushed to GitHub, sign up for your Tina Cloud account at https://app.tina.io/register. Then follow the steps below:

  1. Select new project
  2. Select Import your site
  3. Follow steps to connect your GitHub repo.
  4. Copy your Client ID

Then import to Vercel.

Important: When you import your project on Vercel, make sure to click on Environment Variables and set NEXT_PUBLIC_TINA_CLIENT_ID to the client ID above.

Once you have successfully deployed to Vercel, go back to your Tina dashboard and under the project configuration enter the url in the Site URL(s) for example: https://cms-tina-example.vercel.app/