【发布时间】:2016-07-08 10:19:59
【问题描述】:
大家好,我是 github、jekyll 和 ruby 的新手,也许这个问题已经得到解答,但作为一个新手,我很难解决这个问题。
我试图在一个页面上放置多个分页,即说我有两个 作者在博客上发布了他们的内容,所以我为他们每个人创建了一个部门,并希望为每个人单独分页。所以当前的代码是这样的:
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
{% for post in paginator.posts %}
{% if post.author contains "NAME OF AUTHOR 1" %}
<div class="post-preview">
<a href="{{ post.url }}">
<h2 class="post-title">
{{ post.title }}
</h2>
<h3 class="post-subtitle">
{{ post.description }}
</h3>
</a>
<p class="post-meta">Posted by <a href="#">{{ post.author }}</a> {{ post.date | date_to_string }}</p>
</div>
<hr>
{% endif %}
{% endfor %}
<!-- Pager -->
{% if paginator.total_pages > 1 %}
<ul class="pager">
{% if paginator.previous_page %}
<li class="previous">
<a href="{{ paginator.previous_page_path | prepend: site.url | replace: '//', '/' }}">← Newer Posts</a>
</li>
{% endif %}
{% if paginator.next_page %}
<li class="next">
<a href="{{ paginator.next_page_path | prepend: site.url | replace: '//', '/' }}">Older Posts →</a>
</li>
{% endif %}
</ul>
{% endif %}
</div>
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
{% for post in paginator.posts %}
{% if post.author contains "NAME OF AUTHOR2" %}
<div class="post-preview">
<a href="{{ post.url | prepend: site.url }}">
<h2 class="post-title">
{{ post.title }}
</h2>
<h3 class="post-subtitle">
{{ post.description }}
</h3>
</a>
<p class="post-meta">Posted by <a href="#">{{ post.author }}</a> {{ post.date | date_to_string }}</p>
</div>
<hr>
{% endif %}
{% endfor %}
<!-- Pager -->
{% if paginator.total_pages > 1 %}
<ul class="pager">
{% if paginator.previous_page %}
<li class="previous">
<a href="{{ paginator.previous_page_path | prepend: site.url | replace: '//', '/' }}">← Newer Posts</a>
</li>
{% endif %}
{% if paginator.next_page %}
<li class="next">
<a href="{{ paginator.next_page_path | prepend: site.url | replace: '//', '/' }}">Older Posts →</a>
</li>
{% endif %}
</ul>
{% endif %}
</div>
同样在 _config.yml 下分页设置为 3。
我使用了带有引导程序的 jekyll(如果正确,不是 jekyll-bootstrap)并遵循了一个非常简单的教程,文件结构也非常简单。
感谢您的帮助,我在发布之前阅读了许多文档和许多帖子(总是搞砸了),所以感谢大家。
另外, 该博客托管在http://neorblog.in 和github 存储库https://github.com/neortls007idev/Blog
另外,repo 目前也没有按照上面的代码提交。
【问题讨论】: