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

Add ability to pull in an external file and attach it to a frontmatter property #6

Closed
dillonbheadley opened this issue Feb 20, 2016 · 1 comment
Labels

Comments

@dillonbheadley
Copy link

Something like:
books.md:

  ---
  books: data/books.yaml
  ---

Would that be possible? That way we could have a separate source of data that could be referenced by multiple files as needed.

@Ajedi32
Copy link
Owner

Ajedi32 commented Feb 20, 2016

This seems like the sort of thing that'd be best to do with a plugin further down the pipe. After .use(frontmatter()), add another plugin that reads the metadata from existing files and replaces references to other YAML files with the parsed contents of those files.

That's one of the really nice things about Metalsmith; it's easy to add extra steps like this to customize the build to your liking.

If you need an example to help you get started, metalsmith-metafiles does something similar (though not quite the same), so you could reference the source code of that plugin when writing yours.

Or alternately maybe an existing plugin like metalsmith-metadata might do what you want. (It adjusts global metadata though, not per-file metadata.)

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

No branches or pull requests

2 participants