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

Added file name data to collection items #51

Merged
merged 1 commit into from
Feb 16, 2016
Merged

Added file name data to collection items #51

merged 1 commit into from
Feb 16, 2016

Conversation

rgladwell
Copy link
Contributor

Adds a file property to the collection item's data which contains the file name of the generated file. For example, this can be used in templates to create links.

Includes test case.

@lambtron
Copy link
Contributor

Thanks for submitting the PR! Can this be achieved by using a second plugin (metalsmith-path or metalsmith-paths) after collections that adds the .file property?

@dominicbarnes thoughts here?

@rgladwell
Copy link
Contributor Author

@lambtron thanks, using metalsmith-path seemed to work. Maybe we should document this somewhere in this project though?

@@ -5,6 +5,7 @@ var Matcher = require('minimatch').Minimatch;
var unique = require('uniq');
var read = require('fs').readFileSync;
var loadMetadata = require('read-metadata').sync;
var path = require('path');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is superfluous, looks like it was added and left behind when not needed anymore.

@rgladwell
Copy link
Contributor Author

Hey @dominicbarnes, good spot. I've rebased a couple of updates including a fix for the above:

  • Removed un-used module import
  • Changed name of property file -> path

Adds a `file` property to the collection item's data which contains the
file name of the generated file. For example, this can be used in
templates to create links.

Includes test case.
lambtron added a commit that referenced this pull request Feb 16, 2016
Added file name data to collection items
@lambtron lambtron merged commit caa1c45 into metalsmith:master Feb 16, 2016
@rgladwell
Copy link
Contributor Author

@lambtron thanks, when do you think you'll release a new version of metalsmith-collections?

@bashaus
Copy link
Contributor

bashaus commented Jun 26, 2016

This is causing conflicts with metalsmith-path and metalsmith-paths, see #62

@bashaus bashaus mentioned this pull request Jun 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants