Comments (14)
I think it don't depends on pattern
, but it just don't work for CLI.
from collections.
Any chance that that will be fixed?
from collections.
@BigZ94 why don't you link to your repo and I'll see if I can have a look for you.
from collections.
Bump. Any idea when this issue will be fixed?
I'm following the tutorial at: http://www.robinthrift.com/posts/metalsmith-part-2-shaping-the-metal/
However, the collection (if defined in the index.js as a pattern) doesn't work.
from collections.
I don't know if this is relevant, but it's caught me out a few times. What I have noticed is that in various metalsmith plugins. they don't go deeper than the folder stated. I'm not sure if it's the same with collections. So I only have 1 collection per folder.
from collections.
I only had one collection and the CLI didn't work for me either.
from collections.
Something to watch out for, that I just see. The order of where the metalsmith-collections
in the metalsmith.json
file matter. If you move it after metalsmith-markdown
the files which are being sent to metalsmith-collections
will have a .html
extension, and will not match *.md
$ DEBUG=metalsmith-collections metalsmith
, will show which files are actually being matched.
from collections.
* disclosure: I use grunt-metalsmith
, not the pure metalsmith.json
and CLI approach
from collections.
nlundquist, did you get this fixed? All the 'not working' posts in this thread have little info and follow-up. This feature does and has always worked for me in metalsmith, but I've had a few frustrating hours with some of the other plugins that needed a specific setup to work.
The plugin nature of Metalsmith clearly opens up opportunities, but it also seems to present issues due to the linear nature when parsing the plugins (so one thing must be before another, but after something else, and therefore certain combinations might not work).
If it helps, In my build.js, the first plugin is collections, setup like this:
Metalsmith(__dirname)
.use(collections({
pages: {
pattern: 'pages/.md'
},
posts: {
pattern: 'posts/.md',
sortBy: 'date',
reverse: true
}
})
The folders pags and posts are in an src folder.
from collections.
@simplyeffectiveweb 👍
from collections.
I have run into the same issue. The pattern matching simply would not work via the CLI. I tried using every available example to see if it was just something I was doing wrong but nothing worked. Once I changed to use the metadata, it worked right away.
from collections.
I am currently using the CLI with this plugin, and it works just fine. As mentioned previously, metalsmith-collections
is the very first plugin I invoke:
"plugins": {
"metalsmith-collections": {
"static": {
"pattern": {"*.{html,xml,txt,png,ico}", },
"refer": false
},
"error": {
"pattern": "{403,404}.md",
"refer": false
},
"articles": {
"pattern": "content/articles/*.md ",
"reverse": true
},
"recent-articles": {
"pattern": "content/articles/*.md",
"reverse": true,
"limit": 5
}
},
...
from collections.
The bug looks like already fixed. The pattern works both via CLI and metadata. The only pitfall is that pattern's path is relative to source folder. So if .source('./src')
, then pattern: '*.md'
, not pattern: './src/*.md'
from collections.
This pitfall could be better documented as I suppose it's kind of obvious once you already know it. However my pattern ./*.md
doesn't work. I have to lose the current folder prefix ./
then it works.
from collections.
Related Issues (20)
- Roadmap 2.0 HOT 1
- Proposal: more declarative/condensed sort options
- Use metalsmith.match instead of multimatch
- Next/previous links not set HOT 2
- Update changelog HOT 1
- Absence of metadata in output in non-empty collections HOT 2
- Multiple builds break the plugin HOT 2
- Why is the property added collection and not collections? HOT 3
- Open to other maintainers? HOT 3
- data.path would be more useful with an html extension than a markdown one HOT 1
- storyblok and metalsmithJs (how to create a collection of blog-posts)
- Path not being set properly when using metalsmith-in-place HOT 5
- Metadata for documents contains markdown HOT 1
- Organizing posts into mutiple collections? HOT 1
- How to generate URLs using path variable? HOT 2
- please update npm repo HOT 4
- How to ungroup the grouped .hbs templates in .yaml file in metalsmith pattern collection HOT 4
- Transfer ownership to metalsmith org
- Feature: add 'first' and 'last' references
- Fix ambiguous mapping of metadata vs pattern collections
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from collections.