Example Projects

Here you'll find all the example projects we've created to help you learn how to use Gatsby with Prismic. Feel free to explore how it all works or even use them as boilerplates for your project if it fits your needs!


1. Choose a sample project

Both of these sample projects use the Previews plugin (gatsby-plugin-prismic-previews) and the Gatsby source plugin (gatsby-source-prismic). They pull data from your newly created repositories, and the preview configuration for the code is also ready to use.

Sample blog

The content modeling for this sample blog has two Custom Types: bloghome and post. You'll be able to see both your repository and project code.

The homepage provides a small preview of the existing posts and has built-in pagination that you can customize to your needs.

Multilanguage site

The content modeling for this sample blog has three Custom Types: homepage, post, and menu. And two initial languages that you can explore with the built-in language switcher. You can add any additional languages to your repository.

Sample Gatsby blog
BlogSample blog

Minimalist blog with a full-featured editor.

Sample Gatsby multi-language site

Multi-language site with multiple locals and a language switcher.

2. Run the command

Navigate to the location you want to create your project and run the theme command in the terminal. It'll perform these processes:

  1. Install the Prismic CLI (command-line interface) if it's not yet installed in your machine. This tool will allow you to interact with Prismic from your local machine.
  2. Run the theme command. It'll prompt you to name your Prismic repository and local folder. Then, it'll install the project code locally, download the project files to your machine and create a brand new repository with content.
  3. If you're not logged in to Prismic yet, it'll prompt an option to enter the email and password for your Prismic account (or sign up for an account).

Select the command for the sample project of your choice:

  • Sample blog
  • Multi-language website
Copy
npx prismic-cli theme --theme-url https://github.com/prismicio/gatsby-blog --conf prismic-configuration.js
Copy
npx prismic-cli theme --theme-url https://github.com/prismicio/gatsby-multi-language-site --conf prismic-configuration.js

3. Run the project

Run your project with the following command and view your published content locally.

  • npm
  • Yarn
Copy
npm start
Copy
yarn start

Your site is now running locally at http://localhost:8000. Now you can change the code to customize the website: edit the stylesheets, the templates, and the repository's content to fit your design.

4. Deploy the project

Refer to the dedicated deployment guide and select the option that best fits your needs:


Next steps

Suggested Articles

Now you've got a project up and running. You can jump into the other features that Prismic has in store to make managing your content a breeze. Here are some suggested articles to read.

Build and deploy

Have your own example project to share?

If you have another example project that you think would be helpful to others, we'd be happy to share them on this page as well. Feel free to reach out to us at the Prismic forum, and we'd love to talk to you about getting your project on this page.


Was this article helpful?
Not really
Yes, Thanks

Can't find what you're looking for? Get in touch with us on our Community Forum.