Plugins
Plugins are Node.js packages that implement Gatsby APIs. They enable you to easily solve common website build problems e.g. setup Sass, add markdown support, process images, etc.
For larger / complex sites, they let you modularize your site customizations into site-specific plugins.
Gatsby has a large and growing set of plugins. See below for the list of official plugins. We’ll eventually add support here for searching and browsing both official plugins and community plugins published on NPM.
How to use?
Plugins are just Node.js packages meaning you install them like anything else in node using NPM.
For example, gatsby-transformer-json
is a package which adds support for JSON
files to the Gatsby data layer.
To install it, in the root of your site you run:
npm install --save gatsby-transformer-json
Then in your site’s gatsby-config.js
you add gatsby-transformer-json
to the plugins array like:
module.exports = {
plugins: [`gatsby-transformer-json`],
};
Plugins can take options. See each plugin page below for more detailed documentation on using each plugin.
Locally defined plugins
When you want to work on a new plugin, or maybe write one that is only relevant to your specific use-case, a locally defined plugin is more convenient than having to create an NPM package for it.
You can place the code in the plugins
folder in the root of your project like
this:
plugins
└── my-own-plugin
├── gatsby-node.js
└── package.json
You still need to add the plugin to your gatsby-config.js
like for plugins
installed from NPM.
Each plugin requires a package.json file, but the minimum content is just an
empty object {}
. The name
and version
fields are read from the package
file. The name is used to identify the plugin when it mutates the GraphQL data
structure. The version is used to clear the cache when it changes.
For local plugins it is best to leave the version field empty. Gatsby will generate an md5-hash from all gatsby-* file contents and use that as the version. This way the cache is automatically flushed when you change the code of your plugin.
If the name is empty it is inferred from the plugin folder name.
Like all gatsby-* files, the code is not being processed by Babel. If you want
to use JavaScript syntax which isn’t supported by your version of Node.js, you
can place the files in a src
subfolder and build them to the plugin folder
root.
Official plugins
- gatsby-plugin-catch-links
- gatsby-plugin-create-client-paths
- gatsby-plugin-coffeescript
- gatsby-plugin-feed
- gatsby-plugin-glamor
- gatsby-plugin-google-analytics
- gatsby-plugin-google-tagmanager
- gatsby-plugin-jss
- gatsby-plugin-manifest
- gatsby-plugin-netlify
- gatsby-plugin-nprogress
- gatsby-plugin-offline
- gatsby-plugin-preact
- gatsby-plugin-react-helmet
- gatsby-plugin-remove-trailing-slashes
- gatsby-plugin-sass
- gatsby-plugin-sharp
- gatsby-plugin-sitemap
- gatsby-plugin-styled-components
- gatsby-plugin-twitter
- gatsby-plugin-typescript
- gatsby-remark-autolink-headers
- gatsby-remark-code-repls
- gatsby-remark-copy-linked-files
- gatsby-remark-embed-snippet
- gatsby-remark-images
- gatsby-remark-katex
- gatsby-remark-prismjs
- gatsby-remark-responsive-iframe
- gatsby-remark-smartypants
- gatsby-source-contentful
- gatsby-source-drupal
- gatsby-source-filesystem
- gatsby-source-hacker-news
- gatsby-source-lever
- gatsby-source-medium
- gatsby-source-mongodb
- gatsby-source-wordpress
- gatsby-transformer-documentationjs
- gatsby-transformer-javascript-static-exports
- gatsby-transformer-json
- gatsby-transformer-remark
- gatsby-transformer-sharp
- gatsby-transformer-toml
- gatsby-transformer-yaml
Official components
Community Plugins
- gatsby-plugin-accessibilityjs
- gatsby-plugin-antd
- gatsby-plugin-copy
- gatsby-plugin-elasticlunr-search
- gatsby-plugin-fastclick
- gatsby-plugin-google-fonts
- gatsby-plugin-gosquared
- gatsby-plugin-hotjar
- gatsby-plugin-i18n-readnext
- gatsby-plugin-i18n-tags
- gatsby-plugin-i18n
- gatsby-plugin-intercom-spa
- gatsby-plugin-klipse
- gatsby-plugin-mixpanel
- gatsby-plugin-protoculture
- gatsby-plugin-purify-css
- gatsby-plugin-segment-js
- gatsby-plugin-stripe-checkout
- gatsby-plugin-stripe-elements
- gatsby-plugin-svgr
- gatsby-plugin-typescript-css-modules
- gatsby-plugin-yandex-metrika
- gatsby-remark-emoji
- gatsby-remark-external-links
- gatsby-remark-flowchart
- gatsby-remark-graph
- gatsby-remark-sequence
- gatsby-source-airtable
- gatsby-source-datocms
- gatsby-source-github
- gatsby-source-google-sheets
- gatsby-source-soundcloud
- gatsby-source-stripe
- gatsby-source-twitch
- gatsby-source-workable