-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ALT-1508] feat: add gatsby project to templates and add readmes for templates and test-apps #896
Open
ryunsong-contentful
wants to merge
3
commits into
development
Choose a base branch
from
ALT-1508
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Rename this file to .env.development and fill in the values for the following environment variables | ||
GATSBY_CTFL_ENVIRONMENT= | ||
GATSBY_CTFL_SPACE= | ||
GATSBY_CTFL_ACCESS_TOKEN= | ||
GATSBY_CTFL_PREVIEW_ACCESS_TOKEN= | ||
GATSBY_CTFL_EXPERIENCE_TYPE= | ||
GATSBY_CTFL_DOMAIN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules/ | ||
.cache/ | ||
public | ||
src/gatsby-types.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Studio Experiences with Gatsby single page application example | ||
|
||
## 🚀 Enabling Gatsby with Experiences | ||
1. **Update ExperienceSlugExample.tsx** | ||
|
||
Go to `ExperienceSlugExample.tsx` and fill out the following two consts | ||
|
||
``` | ||
const slug = '' | ||
const localeCode = ''; | ||
``` | ||
|
||
2. **Update env.local.example for useContentfulClient.ts** | ||
|
||
Go to `.env.development.example` and fill out the following fields and rename the file to `.env.development` | ||
|
||
``` | ||
GATSBY_CTFL_ENVIRONMENT= | ||
GATSBY_CTFL_SPACE= | ||
GATSBY_CTFL_ACCESS_TOKEN= | ||
GATSBY_CTFL_PREVIEW_ACCESS_TOKEN= | ||
GATSBY_CTFL_EXPERIENCE_TYPE= | ||
GATSBY_CTFL_DOMAIN= | ||
``` | ||
|
||
3. **Create the Experience in the Contentful Experienecs UI** | ||
|
||
In the settings tab of Experiences, ensure that your Slug field matches the slug in step 1. Save your changes and publish to see this Gatsby project hooked up with Contentful Experiences. | ||
|
||
## 🚀 Quick start | ||
|
||
1. **Create a Gatsby site.** | ||
|
||
Use the Gatsby CLI to create a new site, specifying the minimal TypeScript starter. | ||
|
||
```shell | ||
# create a new Gatsby site using the minimal TypeScript starter | ||
npm init gatsby -- -ts | ||
``` | ||
|
||
2. **Start developing.** | ||
|
||
Navigate into your new site’s directory and start it up. | ||
|
||
```shell | ||
cd my-gatsby-site/ | ||
npm run develop | ||
``` | ||
|
||
3. **Open the code and start customizing!** | ||
|
||
Your site is now running at http://localhost:8000! | ||
|
||
Edit `src/pages/index.tsx` to see your site update in real-time! | ||
|
||
4. **Learn more** | ||
|
||
- [Documentation](https://www.gatsbyjs.com/docs/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter-ts) | ||
- [Tutorials](https://www.gatsbyjs.com/docs/tutorial/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter-ts) | ||
- [Guides](https://www.gatsbyjs.com/docs/how-to/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter-ts) | ||
- [API Reference](https://www.gatsbyjs.com/docs/api-reference/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter-ts) | ||
- [Plugin Library](https://www.gatsbyjs.com/plugins?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter-ts) | ||
- [Cheat Sheet](https://www.gatsbyjs.com/docs/cheat-sheet/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter-ts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { GatsbyConfig } from "gatsby" | ||
|
||
const config: GatsbyConfig = { | ||
siteMetadata: { | ||
title: `gatsby-spa`, | ||
siteUrl: `https://www.yourdomain.tld`, | ||
}, | ||
// More easily incorporate content into your pages through automatic TypeScript type generation and better GraphQL IntelliSense. | ||
// If you use VSCode you can also use the GraphQL plugin | ||
// Learn more at: https://gatsby.dev/graphql-typegen | ||
graphqlTypegen: true, | ||
plugins: [], | ||
} | ||
|
||
export default config |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These steps may need to mention what Content Preview URL to configure. I can't figure it out. I tried:
http://localhost:8000
-> shows the gatsby index page (not studio-enabled)http://localhost:8000/{entry.fields.slug}
-> shows the 404 page (even though I hardcoded the slug variable in ExperienceSlugExample.tsx to match the slug of my experience and published it)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the README to make it work properly