0

I found an example online which uses collections and permalinks, the code is like this:

Metalsmith(__dirname)
    .use(collections({
        pages: {
            pattern: 'content/pages/*.md'
        },
        posts: {
            pattern: 'content/posts/*.md',
            sortBy: 'date',
            reverse: true
        }
    }))
    .use(markdown())
    .use(permalinks({
        pattern: ':collection/:title'
    }))
    .use(templates('handlebars'))
    .destination('./build')
    .build()

Which converts this file structure:

src/
    index.md
    content/
        pages/
            aboud.md
            blog.md
        posts/
            first-post.md

To:

build/
    index.html
    content/pages/ (empty??)
    pages/
        about/ -> index.html
        blog/ -> index.html
    posts/
        first-post/ -> index.html

Note that src/index.md is converted, as well as the collections. But in 1.0.0, the same code converts only the collections and throws an error for index.md: Error: UNKNOWN, open '/home/index.html'

Any idea?

doup
  • 841
  • 1
  • 9
  • 20
  • 1
    Can you add an error callback to the `.build()` call? `function (err) { if(err) console.log(err) }` or something like that – James Khoury Nov 10 '14 at 00:56
  • Thanks, but I just forgot to add the callback in the question, that was not the problem. It got solved but I don't know how (!!), [here is the code](https://github.com/doup/doup.illarra.com/blob/master/gulpfile.js). – doup Nov 11 '14 at 10:43
  • Had a similar issue with node: v0.10.29, metalsmith: v1.7.0. Started working after adding a callback as suggested for debugging by @JamesKhoury to the build() method. – Woody May 29 '15 at 15:01

0 Answers0