【发布时间】:2012-07-31 18:46:14
【问题描述】:
我正在尝试弄清楚如何将 Liquid 的cycle 与 html 适当地结合使用。这是一个永无止境的行,最多 3 列 (float:left) 布局。
<!-- row -->
<div class="single-post-container">
<div class="single-post-item">
<div class="single-post-head">
<a href="{{ post.url }}" />
<h6>{{ post.title }}</h6>
</div>
</div>
<div class="single-post-item">
<div class="single-post-head">
<a href="{{ post.url }}" />
<h6>{{ post.title }}</h6>
</div>
</div>
<div class="single-post-item">
<div class="single-post-head">
<a href="{{ post.url }}" />
<h6>{{ post.title }}</h6>
</div>
</div>
</div>
<!-- row -->
<div class="single-post-container">
<div class="single-post-item">
<div class="single-post-head">
<a href="{{ post.url }}" />
<h6>{{ post.title }}</h6>
</div>
</div>
<div class="single-post-item">
<div class="single-post-head">
<a href="{{ post.url }}" />
<h6>{{ post.title }}</h6>
</div>
</div>
<div class="single-post-item">
<div class="single-post-head">
<a href="{{ post.url }}" />
<h6>{{ post.title }}</h6>
</div>
</div>
</div>
我能够用这个丑陋的东西让它工作一半({{ post.title }} 字面上显示而不是实际标题):
{% for post in site.posts %}
column {%cycle '<div class="single-post-container"><div class="single-post-item"><div class="single-post-head"><a href="{{ post.url }}" /><h6>{{ post.title }}</h6></div></div>', '<div class="single-post-item"><div class="single-post-head"><a href="{{ post.url }}" /><h6>{{ post.title }}</h6></div></div>', '<div class="single-post-item"><div class="single-post-head"><a href="{{ post.url }}" /><h6>{{ post.title }}</h6></div></div></div>'%}
{% endfor %}
请帮忙!也许有更好的方法?
【问题讨论】: