gatsby-source-product-markdown

1.0.9 • Public • Published

gatsby-source-product-markdown

A Gatsby source plugin for product markdown files.

Install

With npm:

npm install --save gatsby-source-product-markdown

With Yarn:

yarn add gatsby-source-product-markdown

Implement

Basic usage:

// ./gatsby-config.js
module.exports = {
    plugins: [
        'gatsby-source-product-markdown'
    ]
}

With custom options:

// ./gatsby-config.js
module.exports = {
    plugins: [
        {
            resolve: 'gatsby-source-product-markdown',
            options: {
                path: './src/markdown/products/**/*.md'
            }
        }
    ]
}

Usage

export const pageQuery = graphql`
    query ProductById($id: String!) {
        productMarkdown(productId: { eq: $id }){
            id
            name
        }
    }
`

Notes

  • Product variants will be automatically unpacked.
  • When querying your data, the id property will be changed to productId to differentiate between the product ID that's in your markdown file and the ID that GraphQL uses.

Package Sidebar

Install

npm i gatsby-source-product-markdown

Weekly Downloads

0

Version

1.0.9

License

MIT

Unpacked Size

255 kB

Total Files

11

Last publish

Collaborators

  • amadoa
  • dalewray
  • codevelopit
  • mastaaaron
  • escasports
  • tbaustin
  • ken85rose