Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-theme-frameio-docs

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-theme-frameio-docs

A Gatsby theme for building documentation websites

  • 4.5.33
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25
increased by2400%
Maintainers
1
Weekly downloads
 
Created
Source

gatsby-theme-apollo-docs

This is an entirely configuration-based Gatsby theme that generates a documentation website based on a series of Markdown or MDX files. It also exports a series of components that can be used within MDX pages.

Installation

If you're using this package, you'll also need to install gatsby and its peer dependencies, react and react-dom. Next, install the theme:

$ npm install gatsby-theme-apollo-docs

Configuration

You can configure gatsby-theme-apollo-docs for use with any set of docs using the provided configuration options. You may also use component shadowing to customize elements like the logo or color scheme.

// gatsby-config.js
module.exports = {
  pathPrefix: '/docs/apollo-server',
  plugins: [
    {
      resolve: 'gatsby-theme-apollo-docs',
      options: {
        root: __dirname,
        subtitle: 'Apollo Server',
        description: 'A guide to using Apollo Server',
        githubRepo: 'apollographql/apollo-server',
        defaultVersion: '2',
        versions: {
          '1': 'version-1'
        },
        sidebarCategories: {
          null: [
            'index',
            'getting-started',
            'whats-new'
          ],
          Features: [
            'features/mocking',
            'features/errors',
            'features/data-sources'
          ]
        }
      }
    }
  ]
};

Options

Option nameTypeRequiredDescription
rootstringYesMust be __dirname
siteNamestringYesThe main title for the website, used in the <title> element and top left corner of the site
descriptionstringYesThe site description for SEO and social (FB, Twitter) tags
sidebarCategoriesobjectYesAn object mapping categories to page paths (see sidebarCategories reference)
subtitlestringNoThe page title that gets rendered above the sidebar navigation
pageTitlestringNoThe string to be rendered in the page's <title> tag. If omitted, siteName will be used.
baseDirstringNoIf your Gatsby site does not live in the root of your project directory/git repo, pass the subdirectory name here (docs, for example)
contentDirstringNoThe directory where docs content exists (content by default)
githubHoststringNoThe hostname of the GitHub server (github.com by default)
githubRepostringNoThe owner and name of the content repository on GitHub
spectrumPathstringNoThe path to be appended to Spectrum links
gaTrackingIdstringNoYour site's Google Analytics tracking ID
algoliaApiKeystringNoYour Algolia DocSearch API key
algoliaIndexNamestringNoThe name of your DocSearch index
baseUrlstringNoThe origin where your website will be hosted (e.g. https://www.apollographql.com)
spectrumHandlestringNoYour Spectrum community's handle/slug
twitterHandlestringNoYour Twitter handle, without the "@"
youtubeUrlstringNoThe URL of your YouTube channel
defaultVersionstringNoAn identifier for the default selected version, served at the root of the docset (/)
localVersionstringNoIf the local files represent a version different from the defaultVersion, specify an identifier for the local version here
versionsarrayNoAn array of objects representing the versions that the website should generate
navConfigobjectNoAn object defining the top-left navigation links (see navConfig reference)
checkLinksOptionsobjectNoOptions accepted by gastby-remark-check-links
ignorearrayNoFiles to ignore using anymatch-compatible definition pattern
gatsbyRemarkPluginsarrayNoAdditional Gatsby Remark plugins to pass to gatsby-transformer-remark and gatsby-plugin-mdx
remarkPluginsarrayNoAdditional Remark plugins to pass to gatsby-plugin-mdx

versions

If omitted, only one version of docs will be built, based on the files in the theme consumer repository. If provided, the versions option expects an object mapping older versions' labels to their respective git branch. The current filesystem will still determine the "default" version. The default label for this version is "Latest", but is configurable by the defaultVersion option.

defaultVersion: '2.5',
versions: {
  '2.4': 'version-2.4'
}

sidebarCategories

The sidebarCategories option is an object keyed by category titles. Each entry in the object is an array of page paths. The path should resemble the location of a Markdown/MDX file in the git repository, relative to contentDir, and without the .md extension. Sidebar navigation items that are not a member of a category live under the null key. To add an external link to your sidebar, your can provide a string formatted like a Markdown link.

{
  null: [
    'index',
    'getting-started',
    'whats-new'
  ],
  Features: [
    'features/mocking',
    'features/errors',
    'features/data-sources'
  ],
  'External links': [
    '[Principled GraphQL](https://principledgraphql.com/)'
  ]
}

navConfig

The navConfig option should be an object keyed by link titles. The values should be objects with description, and url properties. Check out the default theme options for an example of the expected shape of this data.

Algolia configuration

This theme allows you to use Algolia DocSearch to power a search bar in the site. You'll need to provide your API key and index name to the theme in the form of algoliaApiKey and algoliaIndexName options.

To get these, sign up with DocSearch for an open source repo. You'll be able to configure your indexing strategy by submitting a PR to edit your config file in the docsearch-configs repo.

Creating pages

This theme generates pages based on Markdown or MDX files in the contentDir directory of a repo. Your Markdown/MDX files should contain some frontmatter defining their titles and descriptions.

---
title: Introduction
description: What is Apollo Server and what does it do?
---

Apollo Server is the best way to quickly build a production-ready, self-documenting API for GraphQL clients, using data from any source.

Page URLs will be derived from the file paths of your Markdown. You can nest Markdown files within directories to create pages with additional path segments. You can overwrite this default path by adding a slug field to your Markdown frontmatter header.

Component shadowing

You can customize a website using this theme further by taking advantage of component shadowing.

By default, this theme sets the website favicon to the one from Apollo's website within its internal SEO component. If you wanted to use your own favicon, you could shadow the SEO component within your site and add your custom SEO/favicon implementation.

// src/gatsby-theme-apollo-docs/components/seo.js
import React from 'react';
import {Helmet} from 'react-helmet';

export default function SEO({title, description, siteName}) {
  return (
    <Helmet>
      <link rel="icon" href="/path/to/custom-favicon.ico" />
      {/* other SEO tags (OpenGraph, Twitter, etc.) */}
    </Helmet>
  );
}

Components

This theme exports React components that you can use in MDX files throughout a documentation website.

ExpansionPanel

An expandable panel of content used to hide complex information or instructions that might be a tangent from the main topic of the content it lives within.

PropTypeDescription
childrennodeThe content of the panel, usually includes an ExpansionPanelList
titlestringThe title of the panel, visible even when the panel is closed

ExpansionPanelList

A wrapper element that should be used in conjunction with ExpansionPanelListItem components. It renders an li element with some styles baked in.

ExpansionPanelListItem

A list item for use with the ExpansionPanelList. It comes with a cicular area to its left to render a number, glyph, or some way to indicate progress through a set of instructions. You can write Markdown within these elements if you keep everything detabbed and add an empty line between your content and the component's opening and closing tags.

PropTypeDescription
childrennodeThe content of the list item, usually a block of Markdown
numberstringThe number displayed to the left of the list item, or a checkmark if "check" is passed
import {
  ExpansionPanel,
  ExpansionPanelList,
  ExpansionPanelListItem
} from 'gatsby-theme-apollo-docs';

<ExpansionPanel title="How to use the ExpansionPanel component">

Add a line break _between_ JSX tags and content to parse the content as *Markdown*

<ExpansionPanelList>
<ExpansionPanelListItem number="1">

<h4>h4 works well as a heading here</h4>

- markdown
- works
- here

</ExpansionPanelListItem>
<ExpansionPanelListItem number="check">

<h4>That's it!</h4>

> MDX is super fun

</ExpansionPanelListItem>
</ExpansionPanelList>

</ExpansionPanel>

MultiCodeBlock

Wraps adjacent code blocks to allow users to toggle between them using a dropdown menu.

import {MultiCodeBlock} from 'gatsby-theme-apollo-docs';

<MultiCodeBlock>

```js
// a JavaScript code block
```

```ts
// a TypeScript code block
```

</MultiCodeBlock>

Deployment

All docs sites will eventually be deployed into a subdirectory, as configured by the pathPrefix option—/docs/apollo-server, for example. Read this guide to learn more about publishing to a subdirectory.

Migration

To migrate an older Hexo site to this theme, follow this guide.

Examples

Are you using this theme in your own project? Submit a PR with your website added to this list!

License

MIT

Keywords

FAQs

Package last updated on 13 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc