Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

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
concurrency 5 Parallel downloads of article bodies
minIntervalMs 0 Minimum delay (ms) between successive body downloads
dailyBudget Infinity Max number of article bodies to download per run (graceful stop when hit)
maxRetries 3 Retry count for HTTP 429 / 5xx responses
backoffBaseMs 60000 Base backoff for 429 when Retry-After header is missing
stopOnRateLimit true If true, treat terminal 429 as graceful stop (cache preserved)
onRateLimit (waitMs, attempt) => void — called before each 429 retry sleep
onArticleFetched async (article, index, total) => void — per-article hook (good for incremental cache flushing)
onBudgetExhausted () => void — called once when dailyBudget is reached

Rate-limit & budget handling

Starting from 3.1.0, the underlying Downloader:

  • Processes articles newest-first (by updated_at descending) so the most valuable content is captured first under constraint.
  • Automatically retries 429 / 5xx responses with exponential backoff, honoring Retry-After when present.
  • Preserves partial progress: when a run is aborted by a final 429 or dailyBudget exhaustion, the cache is still flushed via writeCache (or yuquePath).
  • Exposes onArticleFetched so callers can persist progress after every successful body download.

getArticles() remains backward compatible; new call shapes are additive:

await client.getArticles();                            // legacy: single page
await client.getArticles({offset: 0, limit: 100});     // explicit paging
await client.getArticles({fetchAll: true, limit: 100}); // auto-paginate

Query for all nodes

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

LICENSE

MIT

© 2026 Gatsby, Inc.