npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gatsby-theme-catalyst-sanity

v7.0.7

Published

Sibling theme for gatsby-theme-catalyst-core to add SANITY.io

Downloads

87

Readme

Gatsby-Theme-Catalyst-Sanity

This theme adds a data layer for SANITY.io on top of gatsby-theme-catalyst-core via component shadowing. This is used as a "core" theme for SANITY.io and is designed to be modified and shadowed itself in the final site. You can see an example of this theme stacked and further customized with gatsby-theme-catalyst-bery.

Demos

Catalyzing Start

gatsby new catalyst-sanity https://github.com/ehowey/gatsby-starter-catalyst-sanity

Theme Options

| Option | Values | Description | | ----------------------------- | ------- | ----------------------------------------------------------------------------------------- | | sanityProjectId | String | Required, Sanity project ID | | sanityDataset | String | Defaults to "production", change to reflect the dataset name you are using in Sanity | | sanityToken | String | Defaults to null, should only be used with env variables for security purposes. | | sanityWatchMode | Boolean | Defaults to true, toggle for watch mode | | sanityOverlayDrafts | Boolean | Defaults to false, toggle for live previews, a token and private dataset is required. | | sanityCreatePages | Boolean | Defaults to true, toggle to turn on/off page generation from SANITY.io. | | sanityCreatePosts | Boolean | Defaults to true, toggle to turn on/off blog post page generation from SANITY.io. | | sanityCreateCategories | Boolean | Defaults to true, toggle to turn on/off category page generation from SANITY.io. | | sanityCreatePostsList | Boolean | Defaults to true, toggle to turn on/off blog post list generation from SANITY.io. | | sanityCreateProjects | Boolean | Defaults to true, toggle to turn on/off project page generation from SANITY.io. | | sanityCreateProjectsList | Boolean | Defaults to true, toggle to turn on/off project list generation from SANITY.io. | | sanityPostPath | String | Defaults to "/posts", is the path for before posts, e.g. site.com/posts/post-1. | | sanityPostListPath | String | Defaults to "/posts", is the path for the posts list, e.g. site.com/posts/. | | sanityProjectPath | String | Defaults to "/projects", is the path for before projects, e.g. site.com/projects/post-1. | | sanityProjectListPath | String | Defaults to "/projects", is the path for the projects list page, e.g. site.com/projects/. | | sanityPostListTitle | String | Defaults to "Posts", is title for the posts list page. | | sanityProjectListTitle | String | Defaults to "Projects", is title for the projects list page. | | sanityDisplayPostListTitle | Boolean | Defaults to true, toggle to turn on/off the post list title.io. | | sanityDisplayProjectListTitle | Boolean | Defaults to true, toggle to turn on/off the project list title.io. |

Sanity Studio

There is a custom sanity studio and data structure located in the starter. This studio should be used as a "base" studio and built on top of for custom content. You can use the desk structure to control whether certain actions are visible to the user or not - e.g. don't want them to see the "Projects" folder, just hide it via the desk structure.

This is a compromised solution, it makes iterating and building a site with SANITY.io as the backend faster and easier - but it locks you in to a base set of data the themes require to successfully build. It is a tradeoff but one that is worth it for a lot of use cases.

Shadowed components

useSiteMetadata.js: This is heart of what allows this theme to function as this hook is used throughout all of the themes to source data like site title, logo, etc. Changing the source form gatsby-config to SANITY.io allows all of these components to be updated without having to actual change their code.

seo.js: This is shadowed to ensure that social images are sourced correctly.

gatsby-node.js

There is quite a bit going on in gatsby-node.js to manage the createPages api from Gatsby. Theme options are used to conditionally build pages in the build process - this means that if you want a blog on your site the "infrastructure" is there in gatsby-node to create the pages but can be turned on/off based on whether you need this feature. This results in some warnings in the build process.

gatsby-node.js is also used to automatically create excerpts and reading time for both projects and posts, this relies on an extended base studio configuration as it looks for the "body" field to create the excerpts. This implementation is based on gatsby-transformer-portable-text.

Query components and template components

Queries and templates are separated to isolate visual components from data components. This is best practice in a Gatsby theme and means that in most cases you can just modify the visual layer through component shadowing and leave the data alone letting you concentrate on design.

These are located at src/components/queries/ and src/components/templates/.

You can see an example of this in use with gatsby-theme-catalyst-hydrogen.