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

@defite/gatsby-theme-defite

v2.3.4

Published

Gatsby theme for defite.ru

Downloads

25

Readme

Gatsby theme for Defite.ru

Gatsby theme for Defite.ru

Preview live site

Why?

I wanted to store theme files separate from content files.

Installation

You don't have Gatsby site

npm i --save react react-dom gatsby @defite/gatsby-theme-defite

You already have Gatsby site

npm i --save @defite/gatsby-theme-defite

In both cases copy contents of site folder from the repository into your gatsby folder and replace example content with yours.

Config

gatsby-config.js is a bit messy, but it's working and once you've configured it, you won't touch it anymore.

module.exports = {
    plugins: [
        {
            resolve: '@defite/gatsby-theme-defite',
            options: {
                contentPath: '/content/', //root folder for posts and pages
                siteMetadata: {
                    en: {
                      title: 'John Doe',
                      description: 'Another Gatsby site',
                    },
                    siteUrl: 'https://another-gatsby-site.com',
                },
                manifestOptions: {
                    name: 'John Doe',
                    short_name: 'John Doe',
                    start_url: '/',
                    background_color: '#ffffff',
                    theme_color: '#663399',
                    display: 'minimal-ui',
                    icon: 'assets/gatsby-icon.png'
                },
                langs: ['en'] // your menu, title of page etc.
            }
        }
    ]
}

Language support

The theme supports different languages. It also works with a single language.

To support multiple languages you must add your language to langs array in gatsby-config.js. First item in the array will be your default language and also it will be shown on on / url.

Menu

Menu is created automatically from your pages. You can control order of menu items and which page to show.

---
showInMenu: true // false to not to show 
menuOrder: 2
---

Translate pages

To translate the page for both English and Russian, I've created two Markdown pages like this:

- content
  - pages
      - home.en.md
      = home.ru.md

Insude home.en.md you will find this:

---
templateKey: home
path: /en/
title: Home
---

For russian (or default) I use this template:

---
templateKey: home
path: /
title: Home
---

Translate posts

Posts dir have a little bit different structure:

- content
  - posts
    - en
      - hello-world.en.md
    - ru
      - hello-world.ru.md

I did this not to create chaos inside the posts directory. I hope it will fit everybody's needs.

Inside hello-worlds.ru.md you'll find:

---
templateKey: blog-post
path: /blog/hello-world
title: Hello world
excerpt: console.log('Hello world');
date: "2018-01-02T08:45:09.284Z"
published: true
---

published key is for making published or draft posts. It is convenient for systems like Forestry.

excerpt key is for making short descriptions of the post in the blog listing page.

Post preview image

Post preview image

In order to add preview image for post, add coverImg key to markdown:

---
coverImg: /uploads/your-cover-image.jpg
---