とを使用するオンラインの例を見つけました。コードは次のようになります。collections
permalinks
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()
このファイル構造を変換するもの:
src/
index.md
content/
pages/
aboud.md
blog.md
posts/
first-post.md
に:
build/
index.html
content/pages/ (empty??)
pages/
about/ -> index.html
blog/ -> index.html
posts/
first-post/ -> index.html
src/index.md
コレクションと同様に変換されることに注意してください。しかし、1.0.0
では、同じコードがコレクションのみを変換し、 に対してエラーをスローしますindex.md
。Error: UNKNOWN, open '/home/index.html'
何か案が?