Skip to content

Commit ab10262

Browse files
authored
Merge pull request #98 from contentstack/fix/MKT-5148-live-edit
Fix/mkt 5148 live edit
2 parents 8e0e9ff + 08b3927 commit ab10262

File tree

4 files changed

+173
-166
lines changed

4 files changed

+173
-166
lines changed

.env.local.sample

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11

2-
#create environment file name as .env.local
3-
#and place following configuration data.
4-
5-
CONTENTSTACK_API_KEY=your_stack_api_key
6-
CONTENTSTACK_DELIVERY_TOKEN=your_delivery_token
7-
CONTENTSTACK_ENVIRONMENT=your_environment_name
8-
9-
# Below config options are for enabling live preview/live edit tags for the starter app
10-
11-
CONTENTSTACK_PREVIEW_HOST= rest-preview.contentstack.com
12-
CONTENTSTACK_PREVIEW_TOKEN= your_live_preview_token
13-
CONTENTSTACK_APP_HOST=app.contentstack.com
14-
CONTENTSTACK_LIVE_PREVIEW= true
15-
CONTENTSTACK_LIVE_EDIT_TAGS= false
16-
17-
#site-map
18-
NEXT_PUBLIC_HOSTED_URL=http://localhost:3000
19-
20-
# CONTENTSTACK_API_HOST=api.contentstack.io
21-
# CONTENTSTACK_REGION=eu
22-
# CONTENTSTACK_BRANCH=main
23-
24-
### NOTE:
25-
# CONTENTSTACK_API_HOST- For setting custom api host for contentstack sdk
26-
# CONTENTSTACK_REGION- For setting custom region for contentstack sdk default is us
27-
# CONTENTSTACK_BRANCH- For setting custom branch for contentstack sdk default is main
28-
29-
# Setting Live Preview URL's
30-
# CONTENTSTACK_PREVIEW_HOST- For eu region use eu-rest-preview.contentstack.com/azure-na-rest-preview.contentstack.com/azure-eu-rest-preview.contentstack.com
2+
# This is a settings file for our application.
3+
4+
# Contentstack is the tool we use to manage our website's content.
5+
# You need to replace 'your_stack_api_key', 'your_delivery_token', and 'your_environment_name' with the actual information.
6+
REACT_APP_CONTENTSTACK_API_KEY=your_stack_api_key
7+
REACT_APP_CONTENTSTACK_DELIVERY_TOKEN=your_delivery_token
8+
REACT_APP_CONTENTSTACK_ENVIRONMENT=your_environment_name
9+
10+
# Live Preview lets us see changes before they are shown on the website.
11+
# Replace 'your_live_preview_token' with the actual information.
12+
REACT_APP_CONTENTSTACK_PREVIEW_HOST=rest-preview.contentstack.com
13+
REACT_APP_CONTENTSTACK_PREVIEW_TOKEN=your_live_preview_token
14+
REACT_APP_CONTENTSTACK_APP_HOST=app.contentstack.com
15+
REACT_APP_CONTENTSTACK_LIVE_PREVIEW=true
16+
REACT_APP_CONTENTSTACK_LIVE_EDIT_TAGS=false
17+
18+
# These are extra settings. You can remove the '#' at the start of the line and fill these if needed.
19+
# REACT_APP_CONTENTSTACK_API_HOST= api.contentstack.io
20+
# REACT_APP_CONTENTSTACK_REGION=us
21+
# REACT_APP_CONTENTSTACK_BRANCH=main
22+
23+
# Notes:
24+
# - REACT_APP_CONTENTSTACK_API_HOST: This is for setting a custom address for the Contentstack tool.
25+
# - REACT_APP_CONTENTSTACK_REGION: This is for setting a custom region for the Contentstack tool (default is 'us').
26+
# - REACT_APP_CONTENTSTACK_BRANCH: This is for setting a custom branch for the Contentstack tool (default is 'main').
27+
# - REACT_APP_CONTENTSTACK_PREVIEW_HOST: If you're in the EU just append "eu-" to "rest-preview.contentstack.com"
28+
# - example eu-rest-preview.contentstack.com

contentstack-sdk/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ if (!!customHostBaseUrl && isValidCustomHostUrl(customHostBaseUrl)) {
4141
ContentstackLivePreview.init({
4242
//@ts-ignore
4343
stackSdk: Stack,
44+
clientUrlParams:{
45+
host: envConfig.CONTENTSTACK_APP_HOST,
46+
},
4447
ssr:false,
4548
})?.catch((err) => console.error(err));
4649

0 commit comments

Comments
 (0)