Astro starter with Contentful
Sign up for a Contentful account. Once you do so, a new space will automatically be created.
Run the following command in your terminal to clone the Contentful Astro starter:
Enter a name for your project.
Press Enter to install the dependencies.
Next, if you plan to use TypeScript, select Yes.
Optionally, you can initialize the project as a git repository.
NOTE: When prompted to install dependencies, if you select No, run the
npm install command. This will install the dependencies manually.
This starter comes with a script to import the required content model and sample content into your Contentful space.
In your terminal, navigate to the newly created project. Run the following command:
When prompted, enter IDs for the following into the terminal: Space ID, Content Delivery API, and the Content Management API. This will initialize the project, create a new file with the filename .env, and store the credentials in that file. It will also create the required content models, and add sample content to the Contentful space.
To start the development server, run the following command in your terminal:
To view the portfolio, navigate to
Create a new repository on GitHub, GitLab, or Bitbucket.
Commit the changes and push the code to the new repository.
Make sure to use the correct GitHub username and the repository name.
Create an account on Netlify.
Click Add new site or Import from Git.
Under the Connect to Git provider section, select GitHub and provide the required authorization.
If you are using GitLab or BitBucket, select that instead.
Once authorized, select your newly created GitHub repository.
To add the Contentful credentials - CONTENTFUL_SPACE_ID and CONTENTFUL_DELIVERY_TOKEN, click Show advanced. Then, click New variable and add the environment variables.
To deploy, click Deploy site.
On successful deployment, you’ll be able to view your site live!