gatsby-source-mastodon

2019-12-02 admin

gatsby-source-mastodon是什么

什么是gatsby-source-mastodon,A GatsbyJS source plugin for fetching user toots from Mastodon

gatsby-source-mastodon使用教程帮助文档

gatsby-source-mastodon

gatsby-source-mastodon logo

A Gatsby source plugin for fetching user toots from Mastodon.

Currently only support a user’s own toots.

Usage

You will need to create an Application with read permission from your Mastodon instance (e.g. https://aus.social/settings/applications).

Add the following block of configuration into your gatsby-config.js. Replace fields surrounded by *** with the correct details.

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-mastodon',
      options: {
        // The api url of your mastodon instance (e.g https://aus.social/api/v1)
        api_url: '***MASTODON_INSTANCE_API_URL***',
        // Number of toots to return
        limit: 25,
        // Access token for your Mastodon application
        access_token: '***MASTODON_ACCESS_TOKEN***',
      },
  ],
}

Query Mastodon Data

A sample of the query is included below, for all available field please check the graphl browser.

{
  allToot {
    edges {
      node {
        id
        url
        content
        reblogs_count
        favourites_count
        account {
          username
        }
      }
    }
  }
}

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-80234.html

文章标题:gatsby-source-mastodon

回到顶部