1
0
mirror of https://github.com/kremalicious/gatsby-redirect-from.git synced 2024-12-22 17:23:24 +01:00

Allow for the markdown query to be

This commit is contained in:
Alistair Russell 2019-01-08 12:33:46 +00:00
parent feb0d1574d
commit 1303d79e36

View File

@ -1,14 +1,16 @@
import chalk from 'chalk' import chalk from 'chalk'
export function createPages({ graphql, actions }) { export function createPages({ graphql, actions }, pluginOptions) {
const { createRedirect } = actions const { createRedirect } = actions
const markdownQuery = pluginOptions.query || 'allMarkdownRemark'
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve( resolve(
graphql( graphql(
` `
{ {
allMarkdownRemark( ${markdownQuery}(
filter: { frontmatter: { redirect_from: { ne: null } } } filter: { frontmatter: { redirect_from: { ne: null } } }
) { ) {
edges { edges {