Skip to content

Instantly share code, notes, and snippets.

@chrisdmacrae
Last active November 25, 2016 23:56
Show Gist options
  • Save chrisdmacrae/130e00d8099b929386f5eb30414a0668 to your computer and use it in GitHub Desktop.
Save chrisdmacrae/130e00d8099b929386f5eb30414a0668 to your computer and use it in GitHub Desktop.

Folder structure

/app
  /components
    component.jsx
  /content
    /page1/
      file.md
      image.png
// Component.jsx recieves the frontmatter and content from the markdown as props
// e.g, this.props.title, this.props.image
const Component = () => {
let req = require.context("../content", true, /^\.\/.*\.png$/);
let image = req.resolve(this.props.image)
return(
<div>
<img src={image} />
</div>
}
}
title image
Example title
image.png

Markdown file contents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment