GithubHelp home page GithubHelp logo

nitzano / gatsby-source-hashnode Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 2.0 3.11 MB

Gatsby source plugin for building websites using Hashnode API as data source

License: MIT License

Dockerfile 3.62% JavaScript 96.32% Shell 0.06%
gatsby gatsby-plugin hashnode

gatsby-source-hashnode's Introduction

gatsby-source-hashnode

Build Gatsby websites with Hashnode as a data source

npm npm-beta npm-total GitHub Repo stars semantic-release Commitizen friendly

Highlights

  • Retrieves user posts
  • Calculates estimated reading time
  • Fetches user details
  • Converts images for gatsby-plugin-image
  • Supported versions
    • Gatsby v4 ( @latest tag)
    • Gatsby v3 (@release-2 tag)

Install

release workflow test workflow

npm install gatsby-source-hashnode

How to use

Configure the plugin in gatsby-config.js:

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: "gatsby-source-hashnode",
      options: {
        username: "<HASHNODE_USERNAME>",
      },
    },
  ],
};

How to query

Get user posts

{
  allHashNodePost {
    edges {
      node {
        brief # "In this article..."
        coverImage {
          # File node (to be used with gatsby-plugin-image)
          childImageSharp {
            gatsbyImageData(layout: FULL_WIDTH, placeholder: BLURRED)
          }
          # OR
          # url // "https://cdn.hashnode.com/...
        }
        slug # "my-great-article"
        title # "My Great Article"
      }
    }
  }
}

Get post's reading time

(With the kind help of reading-time)

{
  allHashNodePost {
    edges {
      node {
        title
        readingTime {
          minutes # 2
          text # "2 min read"
          time # 120000
          words # 100
        }
      }
    }
  }
}

Get user details

{
  allHashNodeUser {
    edges {
      node {
        _id
        blogHandle # "userhandle1"
        coverImage # "https:/...
        dateJoined # "2014-01-01T01:00:00.000Z"
        isDeactivated # false
        isEvangelist # true
        location # "Canada"
        name # "First last"
        numFollowers # 503
        numFollowing # 14
        numPosts # 50
        numReactions # 95
        photo # "https:/...
        publicationDomain # "blog.mydomain.."
        tagline # "I do stuff"
        username # "username1"
      }
    }
  }
}

gatsby-source-hashnode's People

Contributors

alexhyett avatar dependabot[bot] avatar nitzano avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

gatsby-source-hashnode's Issues

Add url helper

Add url field to the full post by using publicationUrl + slug

Publish package with np

Publish with np instead of npm publish

Tasks

  • install np
  • build docker-compose for production
  • try preview publish

Add xo

Add xo linter to the project

Update np

Update np package and make sure yarn release --release-draft-only works

Add sample site

  • Add sample gatsby site to the project to test the library inside
  • Use envrionment variable for the user

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.