私はcycle
、HTMLのblelowでLiquidを適切に使用する方法を理解しようとしています。これは、終わりのない行、最大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 %}
助けてください!たぶんもっと良いアプローチがありますか?