Skip to content
Permalink
Browse files
Add content index with list of content pages
  • Loading branch information
RyanWarner committed Apr 23, 2020
1 parent 162167c commit 6b03abf75a53e39acabdbfeedcbeea4d0bd82d1e
Showing 2 changed files with 44 additions and 0 deletions.
@@ -20,6 +20,13 @@ module.exports = {
path: `${__dirname}/src/images`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `content`,
path: `${__dirname}/src/content`,
}
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
@@ -0,0 +1,37 @@
import React from 'react'
import { graphql } from 'gatsby'

export default ({ data }) => {
console.log('data', data)
const { edges } = data.allMdx

return (
<>
<h1>Content</h1>
<ul>
{edges.map(item => (
<li>{item.node.frontmatter.title}</li>
))}
</ul>
</>
)
}

export const pageQuery = graphql`
query ContentIndex {
allMdx(
filter: {
fileAbsolutePath: {glob: "**/content/**"}
}
) {
edges {
node {
id
frontmatter {
title
}
}
}
}
}
`

0 comments on commit 6b03abf

Please sign in to comment.