gatsby-source-notionso-dante-version
A Gatsby source plugin for sourcing data into your Gatsby application using Notion.so as a backend.
Last updated 6 months ago by dantehemerson .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gatsby-source-notionso-dante-version 
SYNC missed versions from official npm registry.

npm version

gatsby-source-notionso

A Gatsby source plugin for sourcing data into your Gatsby application using Notion.so as a backend.

There is not yet an official API to retrieve data for your pages, so this plugin reverse engineered the current API to get access to the content of a page.

You can find a detailed description about this plugin at: http://www.gatsbyplugins.com

Screenshot

notion.so web side by side

Demo site

Netlify Status

A demo site is available at: http://www.gatsbyplugins.com

This demo site contain detailed information about how to use the plugin.

Installation

$ npm install --save gatsby-source-notionso

or

$ yarn add gatsby-source-notionso

Options

export interface NotionsoPluginOptions extends PluginOptions {
  rootPageUrl: string; // the notion page URL of the root page
  name: string; // name of your data set to identify the data for the instance of this plugin
  tokenv2?: string; // not used yet (the page needs to be public)
  debug?: boolean; // set to true to enable debugging information
}

The plugin will load the page identified by the rootPageUrl but this page will not be rendered: the root page is supposed to contain references to all the pages you want to retrieve data for.

How to use?

In your gatsby-config.js file:

  plugins: [
    {
      resolve: 'gatsby-source-notionso',
      options: {
        name: "<name of your data set>",
        rootPageUrl: "<your page url>",
        debug: false,
      },
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `pages`,
        path: `${__dirname}/src/pages`,
      },
    },
  ],

How to query

Get all posts

If the name of your data set is blog, the following request will allow you to retrieve your data.

query {
  allNotionPageBlog(
    filter: { isDraft: { eq: false } }
    sort: { fields: [indexPage], order: DESC }
  ) {
    edges {
      node {
        title
        slug
        excerpt
        pageIcon
      }
    }
  }
}

References

gatsby source plugin development

Notion API

Various Notion API implementations:

Current Tags

  • 1.1.63                                ...           latest (6 months ago)

3 Versions

  • 1.1.63                                ...           6 months ago
  • 1.1.62                                ...           6 months ago
  • 1.1.61                                ...           6 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (7)
Dev Dependencies (17)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |