gatsby-source-notionso
A Gatsby source plugin for sourcing data into your Gatsby application using Notion.so as a backend.
Last updated 9 months ago by pcarion .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gatsby-source-notionso 
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.6                                ...           latest (9 months ago)

19 Versions

  • 1.1.6                                ...           9 months ago
  • 1.1.5                                ...           9 months ago
  • 1.1.4                                ...           9 months ago
  • 1.1.3                                ...           9 months ago
  • 1.1.2                                ...           9 months ago
  • 1.1.1                                ...           9 months ago
  • 1.1.0                                ...           9 months ago
  • 1.0.5                                ...           9 months ago
  • 1.0.4                                ...           9 months ago
  • 1.0.3                                ...           9 months ago
  • 1.0.2                                ...           9 months ago
  • 1.0.1                                ...           9 months ago
  • 1.0.0                                ...           9 months ago
  • 0.0.6                                ...           9 months ago
  • 0.0.5                                ...           9 months ago
  • 0.0.4                                ...           9 months ago
  • 0.0.3                                ...           10 months ago
  • 0.0.2                                ...           10 months ago
  • 0.0.1                                ...           10 months ago
Maintainers (1)
Downloads
Today 1
This Week 7
This Month 43
Last Day 2
Last Week 14
Last Month 30
Dependencies (6)
Dev Dependencies (16)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |