Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow subobjects in markdown frontmatter arrays to link to files #2255

Merged
merged 2 commits into from
Sep 28, 2017

Conversation

KyleAMathews
Copy link
Contributor

This was a tricky issue that made me work at remembering design decisions from
early this year. Like that saying goes, code you wrote 6 months ago might as well
have been written by someone else :-)

Anyways, the problem was their was some YAML data in a markdown frontmatter that looked like:

blocks:
- head: Servers
  image: ../../assets/images/servers.png
- head: Another
  image: ../../assets/images/another.png

So in JavaScript, an array of objects with the image field pointing to files.

Which we'd assume would be inferred as a link to a File node but it wasn't until
this PR fixed things by fixing

  • our ability to find the parent node while inferring fields
  • setting (new convention) ___PARENT on each subobject in the frontmatter
  • and using that to complete the query.
@KyleAMathews
Copy link
Contributor Author

/cc @fk

@fk
Copy link
Contributor

fk commented Sep 28, 2017

🎉

@fk
Copy link
Contributor

fk commented Sep 28, 2017

Thank you Kyle! 🤗

@gatsbybot
Copy link
Collaborator

Deploy preview ready!

Built with commit 2e0ca7a

https://deploy-preview-2255--gatsbygram.netlify.com

@KyleAMathews
Copy link
Contributor Author

Looks like things are working 👍

@KyleAMathews KyleAMathews merged commit ef48d66 into master Sep 28, 2017
@KyleAMathews KyleAMathews deleted the infer-file-fix branch September 28, 2017 03:42
@gatsbybot
Copy link
Collaborator

Deploy preview ready!

Built with commit 04a6d0e

https://deploy-preview-2255--gatsbygram.netlify.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants