我玩弄豎琴靜態站點生成器並沒有這個博客例子到處,參見例如:http://kennethormandy.com/journal/start-a-blog-with-harp豎琴js +博客例子:有沒有一種方法來設置文章的默認部分?
我問,如果有設置默認模板玉/部分的所有物品的方式而不是爲每件看起來相當不方便的物品定義一個?
E.g.我的應用程序
/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
...
有一個簡單的方法來做到這一點?