【问题标题】:Iterate Jekyll Posts using Pug使用 Pug 迭代 Jekyll 帖子
【发布时间】:2016-12-14 07:11:59
【问题描述】:

我是使用 pug 的新手,我想要完成的基本上是将其转换为 pug 代码。

<div id="home">
   <h1>Blog Posts</h1>
   <ul class="posts">
      {% for post in site.posts %}
          <li><span>{{ post.date | date_to_string }}</span> &raquo; <a href="{{ post.url  }}">{{ post.title }}</a></li>
      {% endfor %}
   </ul>
</div>

这是我的代码,但编译时总是出错。

#home 
    h1 Blog Posts
    - var _posts = [_site.posts]

    ul.blog
        each post in _posts
            li 
            span
                 a(href={post.date | date_to_string}) 
            &raquo a(href={{ post.url }}>{{ post.title }})

【问题讨论】:

    标签: gulp pug jekyll pyjade


    【解决方案1】:

    我有同样的专业,我通过插入这样的纯文本来解决它

    .posts-wrap
      ul
        |{% for post in site.posts %}
        |  <li>
        |    hi,there
        |  </li>
        |{% endfor %}
    

    【讨论】:

    • 我稍后再试试。感谢您的信息。
    猜你喜欢
    • 1970-01-01
    • 2012-05-08
    • 1970-01-01
    • 2015-08-17
    • 1970-01-01
    • 1970-01-01
    • 2017-06-18
    • 1970-01-01
    • 2015-03-26
    相关资源
    最近更新 更多