我正在使用 Harp 静态站点生成器,到处都有这个博客示例,例如: http: //kennethormandy.com/journal/start-a-blog-with-harp
我在问是否有一种方法可以为所有文章设置默认的玉模板/部分,而不是为每篇文章定义一个,这对我来说似乎很不方便?
例如我的应用程序的大纲
/public
/articles
_data.json <--- json with my articles
article.jade <--- I would like to have one template for all articles
instead of having to add files:
article1.jade,
article2.jade, ...
/index.jade
/articles/_data.json
{
"article1": {
"title": "Some article"
},
"article2": {
"title": "Another one"
}
// eventually some more articles ...
}
/index.jade
...
ul
each article, slug in public.articles._data
li
a(href="/articles/#{ slug }") #{ article.name } // generated link only works when for each slug (e.g. "article1") a jade file exists
...
有没有一种简单的方法可以做到这一点?