Skip to content
Source plugin for pulling data into Gatsby from yuque API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
src
.babelrc
.eslintrc.json
.gitignore
.npmignore
.npmrc
LICENSE
README.md
index.js
package.json

README.md

gatsby-source-yuque

NPM version LICENSE version

Source plugin for pulling data into Gatsby from 语雀 API.

Install

npm install --save gatsby-source-yuque

How to use

// In your gatsby-config.js
plugins: [
  {
    resolve: 'gatsby-source-yuque',
    options: {
      login: 'raincal',
      repo: 'blog',
      mdNameFormat: 'title'
    }
  }
]

Options

Name Default Description
baseUrl https://www.yuque.com/api/v2/ base url
login user/team unique name
repo repo name
mdNameFormat title title or slug
timeout 10000 timeout specifies the number of milliseconds before the request times out

Query for all nodes

{
  allYuqueDoc {
    edges {
      node {
        title
        slug
        cover
        description
        created_at
        childMarkdownRemark {
          html
        }
      }
    }
  }
}

Or

{
  allMarkdownRemark(
    sort: { order: DESC, fields: [frontmatter___date] }
    limit: 2000
  ) {
    edges {
      node {
        frontmatter {
          title
          slug
          date
        }
        html
      }
    }
  }
}

Hexo version

LICENSE

MIT

You can’t perform that action at this time.