How to iterate over messages in Hexo with Jade's own design

I know I can use something like this:

- site.posts.each(function(article){
      h2.title= article.title
      p.article= arcticle.content
- })

I am so wrong because Jade has its own full-scale construction for iterating over comethig, but it seems like it doesn't work:

each article in site.posts
     h2.title= article.title
     p.article= arcticle.content
+4
source share
1 answer

You need to do site.posts.toArray()and the loop will work fine. It also confused me, and the answer on github is mostly in Chinese.

https://github.com/tommy351/hexo/issues/321

+7
source

Source: https://habr.com/ru/post/1527186/


All Articles