If you want to quickly create a personal website using Contentful with minimal software development effort, this guide is for you. Follow these steps to explore the Contentful platform with your own personal site.
To get started, you'll need the following:
-
A Github account
-
A Contentful space
You'll need an empty Contentful space. Contentful offers a free space for personal use called an "Intro space" when you create an account.
-
- Visit Contentful’s website, and set up an account if you don’t have one.
Copy and securely save your Space ID and API access tokens.
-
Copy and securely save your Space ID, Delivery API access token, and Preview API access token to your notepad or another safe location on your computer for future use.
Create a temporary CMA (Content Management API) token and ensure it is set to expire as soon as possible.
-
Setup Contentful Pexels integration
- Install the Contentful Pexels app to your new space. Click here
- Install the Contentful Pexels app to your new space. Click here
Content modeling is a crucial aspect of using Contentful. To get you started, I've created a content model complete with sample content. You can easily populate your space using this tool.
-
Enter your space id
-
Enter your management access token
-
Enter your environment ID or simply type "master"
-
Click on “Setup", this would add content to your empty space.
Set up a GitHub account if you don't have one and log in. Fork the following repository by clicking on the "Fork" button.
-
Click on the dropdown menu and choose "Create a new fork" to create a new fork of the repository.
-
You can change the repository name to your desired name. Then click “Create fork”
To deploy the code from GitHub, we can use Vercel. Vercel offers a seamless deployment process for Next.js apps.
-
Visit https://vercel.com/login , login with your github account
-
Add a new Vercel project by clicking the "Add New project" button.
Import the Forked repository from the previous step.
-
Click on Environment variables and add them as follows;
Here are the variables to add: -
NEXT_PUBLIC_CTF_SPACE_ID → your space ID
-
NEXT_PUBLIC_CTF_DELIVERY_TOKEN → Your Contentful Delivery Access Token
-
NEXT_PUBLIC_CTF_PREVIEW_TOKEN → Your Contentful Preview Access Token
-
NEXT_PUBLIC_CTF_ENVIRONMENT → Your Contentful Environment ID, e.g master
-
CONTENTFUL_PREVIEW_SECRET → A secret for setting up content preview. Keep this as you would be needing it.
-
NEXT_PUBLIC_SITE_URL → your site domain URL, if you don’t have one, put any domain for now.
-
NEXT_PUBLIC_GOOGLE_TAGMGR_ID → if you have Google tag manager if not use this "GTM-XXX"
This is what your environment variables should look like:
Licensed under the MIT license.