gatsby-plugin-product-markdown-pages
v1.3.7
Published
A Gatsby source plugin for routing pages from [product markdown](https://github.com/escaladesports/product-markdown-spec) files. Intended to be used with [gatsby-source-product-markdown](https://www.npmjs.com/package/gatsby-source-product-markdown).
Downloads
20
Readme
gatsby-plugin-product-markdown-pages
A Gatsby source plugin for routing pages from product markdown files. Intended to be used with gatsby-source-product-markdown.
Install
With npm:
npm install --save gatsby-plugin-product-markdown-pages
With Yarn:
yarn add gatsby-plugin-product-markdown-pages
Implement
Basic usage:
// ./gatsby-config.js
module.exports = {
plugins: [
'gatsby-plugin-product-markdown-pages'
]
}
This will generate pages based on your id
and category
properties if available. It will pass context variables id
, lowerId
, and upperId
to product pages. For category pages, it will pass a category
context variable. Your paths might look something like:
- /product/id1
- /product/id2
- /category/fruits
- /category/vegetables
Notes
- Product variants will be automatically unpacked.
- When querying your data, the
id
property will be changed toproductId
to differentiate between the product ID that's in your markdown file and the ID that GraphQL uses.