@arcblock/gatsby-theme-docs

Gatsby theme used to build our documentation site

Usage no npm install needed!

<script type="module">
  import arcblockGatsbyThemeDocs from 'https://cdn.skypack.dev/@arcblock/gatsby-theme-docs';
</script>

README

@arcblock/gatsby-theme-docs

This is an entirely configuration-based Gatsby theme that generates a documentation website based on a series of markdown files.

Table of contents

Installation

npm install gatsby @arcblock/gatsby-theme-docs

Configuration

// gatsby-node.js
require('dotenv').config();

const path = require('path');

if (
  !process.env.GATSBY_ALGOLIA_APP_ID ||
  !process.env.GATSBY_ALGOLIA_SEARCH_KEY ||
  !process.env.GATSBY_ALGOLIA_ADMIN_KEY ||
  !process.env.GATSBY_ALGOLIA_INDEX_NAME
) {
  throw new Error('@arcblock/gatsby-theme-docs requires valid algolia search config to work');
}

module.exports = {
  plugins: [
    {
      resolve: require.resolve('@arcblock/www'),
    },
    {
      resolve: require.resolve('@arcblock/gatsby-theme-docs'),
      options: {
        version: 'v0.36.1',
        sourceDirs: [
          path.resolve(__dirname, 'src', 'docs'),
          path.resolve(__dirname, 'src', 'tutorials'),
          path.resolve(__dirname, 'src', 'pages'),
        ],
        siteMetadata: {
          title: 'ArcBlock Docs',
          description: 'Forge SDK Documentation',
        },
        algoliaSearch: {
          enabled: true,
          appId: process.env.GATSBY_ALGOLIA_APP_ID,
          adminKey: process.env.GATSBY_ALGOLIA_ADMIN_KEY,
          searchKey: process.env.GATSBY_ALGOLIA_SEARCH_KEY,
          indexName: process.env.GATSBY_ALGOLIA_INDEX_NAME,
        },
        navItems: [
          {
            title: 'Versions',
            link: '/versions',
            subPages: {
              'https://github.com/ArcBlock': 'v0.36.1',
              'https://www.arcblock.io': 'v0.35.0',
            },
          },
          {
            title: 'Community',
            link: '/community',
            subPages: {
              'https://github.com/ArcBlock': 'GitHub',
              'https://www.arcblock.io': 'About',
              // 'https://gitter.im/ArcBlock/community': 'Gitter',
              'https://community.arcblockio.cn': 'Community',
              'https://twitter.com/ArcBlock_io': 'Twitter',
              'https://youtube.com/channel/UC0pEW_GOrMJ23l8QcrGdKSw': 'YouTube',
            },
          },
        ],
        maxImageWidth: 1000,
        extraPlugins: [],
      },
    },
  ],
};

Login Support

This theme has built-in support for DID:Connect service powered login.

Just set GATSBY_DID_CONNECT_APP_DID and GATSBY_DID_CONNECT_SERVICE in your config file, everything should work.

Sample Config

GATSBY_ALGOLIA_APP_ID="FU81LCBN51"                                  # required to init algolia
GATSBY_ALGOLIA_ADMIN_KEY="7eec833"                                  # required to update index on algolia search
GATSBY_ALGOLIA_SEARCH_KEY="2e4d21878c80877e1"                       # required to enable search on algolia
GATSBY_ALGOLIA_INDEX_NAME="forge-cli-handbook"
GATSBY_DID_CONNECT_APP_DID="zNKfp1scmdbfedSe9Vch2fhGiA8TK9r7fL9Z"
GATSBY_DID_CONNECT_SERVICE="https://connect.wallet.arcblockio.cn"