次の設定で metalsmith-permalinks を使用しています。
.use(permalinks({
pattern: ':title',
linksets: [{
match: { collection: 'blogposts' },
pattern: 'blog/:title'
}, {
match: { collection: 'portfolioposts' },
pattern: 'portfolio/:title'
}]
}))
ただし、関連するコレクションのファイルをログに記録するpath
と、メタデータに追加されていないことが示されます。
layout: 'subpage.hbs',
title: 'Blog Post',
date: 2016-08-16T00:00:00.000Z,
excerpt: 'This post has an excerpt',
tags: [ 'test', 'test-tag', 'a-third-tag' ],
contents: <>,
mode: '0644',
stats: {},
collection: [ 'blogposts' ]
パーマリンクはレイアウトの前に呼び出されています。つまり、ここで見つかった同じ問題ではありません。また、ログに見られるように、他のプラグインがメタデータを正常に追加しています。
私の完全なビルド順序は次のとおりです。
.use(collections({}))
.use(tags({}))
.use(permalinks({}))
.use(dateFormatter({}))
.use(markdown({}))
.use(helpers({}))
.use(layouts({}))
.use(rename({}))
また、Metalsmith を Gulp で直接実行しています。どんな助けでも大歓迎です。