Skip to content

gatsby-theme-catalyst-bery

This theme is for a personal blog and demonstrates tight integration with SANITY.io as the CMS and Gatsby as the frontend. It comes with a preconfigured content schema for SANITY.io and demonstration data you can import for a quick start. It features SEO optimization, social image sharing, RSS feed integration, and a clean design language that focuses on your content.

This is also an example of “ejecting” from using a preset header themes and building your own custom header to interact with the other Catalyst themes. The header used here is completely custom for this theme, and not one of the prebuilt options available.

Demos

Catalyzing Start

Because this theme and starter relies on a SANITY.io backend there are a few additional steps to get up and running.

Install the theme and starter

## Install the theme and starter
gatsby new bery https://github.com/ehowey/gatsby-starter-catalyst-bery
cd bery

Install SANITY.io

## Initiate a new SANITY project using their CLI
cd sanity-studio
sanity install
## Setup a new SANITY.io dataset
## Choose Yes to reconfigure the SANITY project
## Chose Yes to use the default dataset configuration
sanity init
## Import the placeholder data
## Import to the "production" dataset
cd data
sanity dataset import production.tar.gz
# Deploy the graphql schema
cd ..
sanity graphql deploy
# Start your studio on a localhost
sanity start

Update your gatsby-config

You need to update the sanityProjectId from SANITY.io so that the theme can properly source its data. You can find this at the top of the file sanity-studio/sanity.json.

Update your gatsby-config.js:

{
resolve: `gatsby-theme-catalyst-bery`,
options: {
sanityProjectId: `c1x70rzt`, // Change this line
},
},

Run gatsby develop

Open a new terminal window and run gatsby develop in the root directory. Your site will build in watch mode with real time previews hot reloaded from SANITY.io! With both SANITY and Gatsby running at the same time you can make edits in your SANITY.io backend and immediately see those updates on your site.

Theme options

Bery accepts all options from the core theme and sanity theme directly, e.g. you can set useColorMode via gatsby-theme-catalyst-bery and it is passed down to the correct theme appropriately. Note that because of the custom header component and the theme design some theme options may not work as expected - e.g. the site title and avatar image are not optional as they hardcoded into the custom header. This theme was built with a more singluar design and is best modified via component shadowing if needed.

For example the following config is valid:

{
resolve: `gatsby-theme-catalyst-bery`,
options: {
sanityProjectId: `4w5ygwpy`, // Required
sanityPostListTitle: "Posts",
rssTitle: "My Great Blog",
rssDescription: "A little description of who I am and why I am great.",
// Defaults
// sanityPostPath: `/posts`,
// footerContentLocation: "center",
// sanityPostListTitle: "Blog",
// sanityPostListPath: `/`,
},
},

Bery Options

OptionValuesDescription
rssTitleStringSet the RSS title for your feed.
rssDescriptionStringSet the RSS title for your feed.

Sanity Theme Options

OptionValuesDescription
sanityProjectIdStringRequired, Sanity project ID
sanityDatasetStringDefaults to “production”, change to reflect the dataset name you are using in Sanity
sanityTokenStringDefaults to null, should only be used with env variables for security purposes.
sanityWatchModeBooleanDefaults to true, toggle for watch mode
sanityOverlayDraftsBooleanDefaults to false, toggle for live previews, a token and private dataset is required.
sanityCreatePagesBooleanDefaults to true, toggle to turn on/off page generation from SANITY.io.
sanityCreatePostsBooleanDefaults to true, toggle to turn on/off blog post page generation from SANITY.io.
sanityCreateCategoriesBooleanDefaults to true, toggle to turn on/off category page generation from SANITY.io.
sanityCreatePostsListBooleanDefaults to true, toggle to turn on/off blog post list generation from SANITY.io.
sanityPostPathStringDefaults to “/posts”, is the path for before posts, e.g. site.com/posts/post-1.
sanityPostListPathStringDefaults to “/posts”, is the path for the posts list, e.g. site.com/posts/.

Core Theme Options

Note that many of these options will not work with catalyst-bery but are still accessible in the theme options config. This is because the theme is more custom and has a unified design.

OptionValuesDescription
contentPathStringDefaults to “content/pages”, determines where the pages are created from.
assetPathStringDefaults to “content/assets”, determines where the page assets like images are located.
displaySiteLogotrue or falseDefaults to true, controls whether the logo is displayed
displaySiteLogoMobiletrue or falseDefaults to true, controls whether the logo is displayed at the mobile breakpoint
displaySiteTitletrue or falseDefaults to true, controls whether the site title is displayed
displaySiteTitleMobiletrue or falseDefaults to true, controls whether the site title is displayed at the mobile breakpoint
invertLogotrue or falseDefaults to false, controls whether the logo is inverted when the mobile menu is open
useStickyHeadertrue or falseDefaults to false, controls whether the header is sticky or static
useSocialLinkstrue or falseDefaults to true, controls whether the social links are displayed or not
useColorModetrue or falseDefaults to true, controls whether the dark mode toggle is available.
useKatextrue or falseDefaults to false, enables gatsby-remark-katex for displaying math equations.
footerContentLocationString value, “left”, “right” or “center”Defaults to “left”, determines the location of the footer content.
remarkImagesWidthInteger valueDefaults to 1440, allows you to customize the image width option for gatsby-remarks-images.

Variants

To be implemented in a future release.

© 2020 Gatsby Theme Catalyst