2017-08-18 41 views
1

我创建了一个新的页面无法正常工作,有一个for循环显示的帖子列表中,但作为expcted enter image description here杰奇for循环如预期

,这里是我的代码不能正常工作:

<!DOCTYPE html> 
<html> 
<head> 
    <title></title> 
</head> 
<body> 
<ul> 
    {% for post in site.posts %} 
    <li> 
     <a href="{{ post.url }}">{{ post.title }}</a> 
     {{ post.excerpt }} 
    </li> 
    {% endfor %} 
</ul> 
</body> 
</html> 

回答

3

添加前端事务,以便Jekyll知道它必须处理它。

只需在文件的开头添加破折号的两行:

--- 
--- 
<!DOCTYPE html> 
<html> 
<head> <title></title> </head> 
<body> 
<ul> 
{% for post in site.posts %} 
<li> <a href="{{ post.url }}">{{ post.title }}</a> {{ post.excerpt }} </li> 
{% endfor %} 
</ul> 
</body> 
</html> 
+0

它的工作,谢谢。 –