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-codex

v0.3.0

Published

A Gatsby theme to bootstrap your own digital codex.

Downloads

6

Readme

gatsby-theme-codex 📖

A Gatsby theme to bootstrap your own digital codex.

Motivation

I created gatsby-theme-codex after reading a very influential post from Tom Critchlow called Building a digital garden. This led me to other great pieces of writing, including Robin Sloan's Stock vs Flow.

Stock is the durable stuff. It’s the content you produce that’s as interesting in two months (or two years) as it is today. It’s what people discover via search. It’s what spreads slowly but surely, building fans over time.

gatsby-theme-codex is a place to build your stock.

Why build stock anyway?

Before taking my word for it, I highly recommend reading the above blog posts.

I take a lot of notes on just about everything. You might do the same, whether it be in a digital notebook or a physical one. The idea of the codex is to share these notes with the world. Publish them in the open. Evolve them over time and watch them grow.

Why call it a codex?

This is just my name choice for a digital garden. It's inspired by Leonardo Da Vinci, who was esteemed for his detailed notebooks.

Other solutions

John Otander is building a project called gatsby-theme-digital-garden that I highly recommend you check out if you are at all interested in this concept. His livestream with Jason Lengstorf on Gatsby themes was super helpful, and he's building a much more robust version of a digital garden than this project. I decided to roll my own for learning purposes / less requirements / quicker turnaround.

Getting started

yarn add gatsby-theme-codex gatsby react react-dom

# or

npm install gatsby-theme-codex gatsby react react-dom

Add the following to your gatsby-config.js file:

// gatsby-config.js

module.exports = {
  plugins: ['gatsby-theme-codex']
}

Finally, create a codex directory at the root of your project:

codex/
gatsby-config.js
package.json

Folder structure

The codex has the following structure:

codex/
├── topic-name/
    └── entry-name-1.md
    └── entry-name-2.mdx

gatsby-theme-codex supports entries as .md or .mdx files.

Configuration options

src

You can optionally tell gatsby-theme-codex where your entries are by adding a src option. This is helpful if you don't want to have a codex directory at the root of your project, or if you want to name it something different:

src/
├── notes/
gatsby-config.js
package.json
// gatsby-config.js

module.exports = {
  __experimentalThemes: [
    {
      resolve: 'gatsby-theme-codex',
      options: {
        src: 'src/notes'
      }
    }
  ]
}

codexPath

By default, gatsby-theme-codex will render your codex at www.yoursite.com/codex/:topic-name/:entry-name. You can change the codex path by passing a codexPath option inside of gatsby-config.js:

// gatsby-config.js

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-theme-codex',
      options: {
        codexPath: '/custom-path' // make sure to include the forward slash! '/'
      }
    }
  ]
}

The example above would render your content at www.yoursite.com/custom-path/:topic-name/:entry-name.

Shadowing components

Gatsby themes come with a feature known as component shadowing.

This feature allows users to override a component in order to customize its rendering.

gatsby-theme-codex comes with 3 components, each of which can be shadowed. I encourage you to do so, as the default components rendered by gatsby-theme-codex are too minimal - even for my taste!

Codex

The Codex component is rendered at /:codexPath, and can be shadowed in your project by adding a codex.js file at src/gatsby-theme-codex/components/. It receives the following props:

interace Codex {
  topics: {
    name: string;
    url: string;
    entryCount: number;
  }[]
}

Topic

The Topic component is rendered at /:codexPath/:topic-name, and can be shadowed in your project by adding a topic.js file at src/gatsby-theme-codex/components/. It receives the following props:

interace Topic {
  name: string;
  entries: {
    name: string;
    url: string;
  }[]
}

Entry

The Entry component is rendered at /:codexPath/:topic-name/:entry-name, and can be shadowed in your project by adding an entry.js file at src/gatsby-theme-codex/components/. It receives the following props:

interace Entry {
  children: React.Node;
  name: string;
  topic: {
    name: string;
    url: string;
  }
}

Note: The components above are each pages, therefore they receive page-specific props such as location.

Project Goals

I plan on evolving this project over time to fit my needs. The goal here is to provide a minimal set of tools that allows the user to create awesome content for themselves, without getting bogged down with features and use cases.

Features may be added over time, but the goal will always be to let the content shine. The content should be prioritized above all else.