1
我今天晚上为my website添加了分页,我遇到了现在我已经破坏了整个网站的问题。发布建设Jekyll博客文章页面和编辑
我对文件使用标准的Jekyll目录结构。对于我的网站,我希望索引页面关于我,然后点击/blog
页面查看我的博客。所以我有index.md是通过主页。然后我有一个页面blog.html成为博客页面。我曾经使用{% for post in site.posts limit: 10 %}
工作,并根据最新文档如何建议循环并打开,切换到{% for post in paginator.posts %}
。在我的_config.yml文件中,我有:
paginate: 10
paginate_path: "blog/page:num"
permalink: /blog/:year/:month/:day/:title.html
我希望分页为/blog/page2.html。我不确定我配置错了什么。这里是我的整个blog.html页面:
---
title: Blog
layout: default
permalink: /blog/index.html
---
{% for post in paginator.posts %}
<div class="row">
<div class="col-lg-12">
{% if post.layout contains "link" %}
<h4><a href="{{post.url}}"><i class="icon-link"></i> {{post.title}}</a></h4>
{% else %}
<h4><a href="{{post.url}}">{{post.title}}</a></h4>
{% endif %}
<small>{{post.date | date: "%m/%d/%Y"}}</small>
<div class="post-content-truncate">
{% if post.content contains "<!-- more -->" %}
{{ post.content | split:"<!-- more -->" | first % }}
<a href="{{post.url}}">Read full article...</a>
{% else %}
{{ post.content }}
{% endif %}
</div>
</div>
</div>
{% endfor %}
{% if paginator.total_pages > 1 %}
<div class="row">
<div class="col-lg-12">
<ul class="pagination">
{% if paginator.previous_page %}
<li><a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">« Prev</a></li>
{% else %}
<span>« Prev</span>
{% endif %}
{% for page in (1..paginator.total_pages) %}
{% if page == paginator.page %}
<li><em>{{ page }}</em></li>
{% elsif page == 1 %}
<li><a href="{{ '/index.html' | prepend: site.baseurl | replace: '//', '/' }}">{{ page }}</a></li>
{% else %}
<li><a href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}">{{ page }}</a></li>
{% endif %}
{% endfor %}
{% if paginator.next_page %}
<li><a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}">Next »</a></li>
{% else %}
<li><span>Next »</span></li>
{% endif %}
</ul>
</div>
</div>
{% endif %}
任何想法,我要去哪里错了?