Giter Site home page Giter Site logo

Comments (14)

sigo avatar sigo commented on July 4, 2024

I think it don't depends on pattern, but it just don't work for CLI.

from collections.

BitFis avatar BitFis commented on July 4, 2024

Any chance that that will be fixed?

from collections.

budparr avatar budparr commented on July 4, 2024

@BigZ94 why don't you link to your repo and I'll see if I can have a look for you.

from collections.

iqbalali avatar iqbalali commented on July 4, 2024

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.

seffw avatar seffw commented on July 4, 2024

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.

nlundquist avatar nlundquist commented on July 4, 2024

I only had one collection and the CLI didn't work for me either.

from collections.

constantx avatar constantx commented on July 4, 2024

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 .htmlextension, and will not match *.md

$ DEBUG=metalsmith-collections metalsmith, will show which files are actually being matched.

1__tbones-mbp__node_

from collections.

constantx avatar constantx commented on July 4, 2024

* disclosure: I use grunt-metalsmith, not the pure metalsmith.json and CLI approach

from collections.

seffw avatar seffw commented on July 4, 2024

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.

constantx avatar constantx commented on July 4, 2024

@simplyeffectiveweb 👍

from collections.

remotesynth avatar remotesynth commented on July 4, 2024

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.

GRUBES avatar GRUBES commented on July 4, 2024

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.

romaklimenko avatar romaklimenko commented on July 4, 2024

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.

Jackbennett avatar Jackbennett commented on July 4, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.