使用Jekyll 3.3我在 <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ExternalProgram>
</ExternalProgram>
<StartExternalURL>
</StartExternalURL>
<StartCmdLineArguments>
</StartCmdLineArguments>
<StartWorkingDirectory>
</StartWorkingDirectory>
<EnableENC>True</EnableENC>
<AlwaysStartWebServerOnDebug>True</AlwaysStartWebServerOnDebug>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
文件中创建一个数组:
_config.yml
我想为每个用户获取值profiles:
- user1:
- username: "test"
- link: "http://test.test"
和username
。所以我使用双循环:
link
但那不打印任何东西,我错过了什么吗?
答案 0 :(得分:3)
数据安排如下:
profiles:
- username: "test"
link: "http://test.test"
- username: "test2"
link: "http://test.test2"
你可以这样做:
{% for user in site.profiles %}
<a href="{{ user.link }}">{{ user.username }}</a>
{% endfor %}