Startup Pro comes with Sanity.io integration for managing a Blog.
In this part of the documentation, we are going to show you how you can integrate Sanity into the Startup Pro Template and start your blog.
Follow the steps below to integrate Sanity into your Startup Pro Template.
- Go to Sanity.io and click on the Start Building button to create the project.
- After you’ve clicked on that button you’ll be asked to log in if you haven’t logged in yet.
- Once you’ve logged in you’ll be asked a few questions, as shown below. Go ahead and answer them as we did here.
Note: After the project is created successfully you’ll get a Sanity Studio installation command, we don’t need that here. Just close that window and follow the rest of the steps to complete the integration.
- Get the key from the project: To get the key login to Sanity.io/manage and then go to the project you want to connect. When you go to the project, you’ll see Project ID under the Project name as shown below. Go ahead and copy it.
- Now add this Project ID to the .env file, to the following variable:
- Now, add the following data to the Sanity.config.ts file. We need the TItle, ProjectID, and Dataset of the project.
You can find the Sanity.config.ts file on the root of the template.
- Go to http://localhost:3000/admin to add the URL. You’ll be redirected to a page that looks like this. Go ahead and click on Continue It’ll take you to your Sanity Projects Dashboard.
Add the URL as a CORS origin.
- Log in to the studio to start writing. To login go to http://localhost:3000/admin. You’ll be redirected to a login page where you’ll see all the providers you can use to log in.
Choose the provider you want to log in with. We are going to log in with GitHub
- After you’ve logged in you’ll be redirected to Sanity Studio Dashboard. From the dashboard, you can post Articles and add Authors.
The integration is done!
Let’s go ahead and see how you can add an Article and an Author to your blog.
Create an Author
- Select the author tab then click on the Create icon as shown below.
- Add the required data to create an Author. After that click on the Publish button to publish it.
The author is created successfully, now let’s write an article.
Write an Article
- Click on the Post button then the Create post icon as shown below.
- Now write the article by adding all the required data like the Title, Metadata, and the Tags.
After that click on the Publish button to publish the article.
If everything is done correctly you’ll see the article on the Blog page.