私はJekyllによって生成されたウェブサイト上でpaginatorを使用して奇妙な動作をしています。 私は最後の3つの投稿のリストを
<ul class="post-list">
{% for post in site.posts limit:3 %}
<li>
<span class="post-meta">{{ post.date | date: "%b %-d, %Y" }}</span>
<h2>
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
</h2>
<p>{{ post.excerpt }}</p>
</li>
{% endfor %}
</ul>
私がジキルのページャーを起動し、
{% for post in site.posts %}
<div class="post-preview">
<a href="{{ post.url | prepend: site.baseurl }}">
<h2 class="post-title">{{ post.title }}</h2>
{% if post.subtitle %}
<h3 class="post-subtitle">
{{ post.subtitle }}
</h3>
<p>{{ post.excerpt }}</p>
{% endif %}
</a>
<p class="post-meta">Posted by {% if post.author %}{{ post.author }}{% else %}{{ site.title }}{% endif %} on {{ post.date | date: "%B %-d, %Y" }}</p>
</div>
<hr>
{% endfor %}
post.excerpt
空になる。私は標準的な動作とトリックの両方で試しました。
_config.ymlのビルド設定は以下のようになります:
# Build settings
gems: [jekyll-sitemap]
markdown: kramdown
highlighter: rouge
permalink: pretty
paginate: 5
paginate_path: "/archives/page/:num"
ありがとうございました
回答:
回答№1は1あなたが置いた {{ post.excerpt }}
条件文での式。
{% if post.subtitle %}
<h3 class="post-subtitle">{{ post.subtitle }}</h3>
<p>{{ post.excerpt }}</p>
{% endif %}
だから、字幕も抜粋もない!
これの方が良い :
{% if post.subtitle %}
<h3 class="post-subtitle">{{ post.subtitle }}</h3>
{% endif %}
<p>{{ post.excerpt }}</p>
改ページされた投稿をレンダリングするには、ループインする必要があります paginator.posts
ドキュメントを参照してください