Closed carolineBda closed 7 years ago
@carolineBda I think I understand what your issue is now. I thought you were saying that the entire object was just a string since there wasn't enough to work off of, but now it sounds like you have some other issue. I'm still honestly not sure if I'm reading it right, so having a reproduction or better before/after can save a lot of time in the future.
The path
property was added in Metalsmith collections over a year ago now (see https://github.com/segmentio/metalsmith-collections/commit/8163c4e62f098ee01f3524fd171c1af929cb788b). I've used it perfectly fine in my blog (https://github.com/blakeembrey/knowledge/blob/7e449b78090035e73aa94010c6bd8f667b7ebf8b/package.json) with 0.9.0
. Were you expecting something else from this plugin?
Yes it is the entire path object itself which is wrong when I upgrade metalsmith-collections verison
In my template
{{#each pagination.files}}
{{log path}}
The output is :
With metalsmith-collections@0.7.0
{ root: '',
dir: 'articles',
base: 'lexique-satisfaction-client-P.md',
ext: '.md',
name: 'lexique-satisfaction-client-P',
href: '/articles/lexique-satisfaction-client-P.md',
dhref: '/articles/' }
With metalsmith-collections@0.9.0
articles/lexique-satisfaction-client-P.md
The only difference between the two is the version of metalsmith-collections
It seems like you probably had a plugin or something that was doing that for you. If that's what you want, you can do it yourself: https://nodejs.org/api/path.html#path_path_parse_path. As far as I've ever known, path has been a string though and nothing else. Since this isn't related to this library, I'm going to close the issue. If you aren't convinced, feel free to open the issue on metalsmith-collections or post a reproducible demo I could look at.
In fact, it's exactly that: https://github.com/ahmadnassri/metalsmith-paths. If you want that information, change the property as documented in their README.
Oh I see. Good spot! Actually it is because in their new version they override it : https://github.com/segmentio/metalsmith-collections/commit/caa1c45423c5df8e07708127ed19647b92f14b64#diff-6d186b954a58d5bb740f73d84fe39073R39
Shame :(
Thanks for your help and your reactivity
When you upgrade metalsmith-collections from 0.7.0 to 0.9.0 then the path field in the file object listed in pagination.files become a string
"articles/le-theatre-entreprise.md"
instead of being the usual object :
My setup is :