Jekyll for loop can';I don’我没有按预期工作
我创建了一个新页面,有一个for循环来显示帖子列表,但它不能像expected那样工作 这是我的代码:Jekyll for loop can';I don’我没有按预期工作,jekyll,liquid,yaml-front-matter,Jekyll,Liquid,Yaml Front Matter,我创建了一个新页面,有一个for循环来显示帖子列表,但它不能像expected那样工作 这是我的代码: <!DOCTYPE html> <html> <head> <title></title> </head> <body> <ul> {% for post in site.posts %} <li> <a href="{{ post.url }}"
<!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>
{site.posts%中的post为%s}
-
{{post.extract}}
{%endfor%}
添加前端内容,以便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>
---
---
{site.posts%中的post为%s}
- {{post.extract}}
{%endfor%}