⚠️ This is a legacy help doc. Please install the new Preview Extension for Sanity Studio.
Installing this Sanity Studio dashboard widget will make it easier for content editors to access Preview from Sanity. The widget triggers Gatsby Cloud instances.
Prerequisites
The site must be set up with a Gatsby Preview instance. Please see “Getting Started with Gatsby Preview and Sanity”.
Installing
Installing the dashboard plugin
If you haven’t installed the Sanity dashboard plugin yet, you’ll need to install it to get dashboard support in Sanity Studio in general. Run this command inside the studio folder:
sanity install @sanity/dashboard
Installing the Gatsby widget plugin
Then, install the Gatsby widget plugin by running this command inside the studio folder:
sanity install dashboard-widget-gatsby
Configuring
Implement your own dashboardConfig by following these steps:
- In your
studio/sanity.json
file, append the following line to theparts
array:{ "implements": "part:@sanity/dashboard/config", "path": "src/dashboardConfig.js" }
- Find the
dashboardConfig.js
file, which should be at the path specified in the previous step. ThedashboardConfig.js
andsanity.json
should point to the same location. Add thegatsby
widget config:export default { widgets: [ { name: "gatsby", options: { sites: [{ siteUrl: "" }] }, }, ], };
Note: You can change the order of the widgets to change how they look in the studio dashboard. See Sanity docs here for more details.
Widget options
-
siteUrl
- The Gatsby Cloud Preview url
What the widget should look like inside Sanity Studio
Now, when anyone opens Sanity Studio, they can access the button from the dashboard!
Comments
0 comments
Please sign in to leave a comment.