2017-08-17 45 views
0

首先,我使用杰基尔3.5.1杰基尔分页指数没有找到

我已经启用了分页,我杰基尔的配置​​,并增加了以下我_config.yml文件:

#pagination 
paginate: 5 
paginate_path: "blog/page:num" 

在我的根目录中,我创建了一个名为'blog'的文件夹,里面有一个'index.html'文件。然而,当我尝试提供文件时,我得到了分页无法找到index.html文件的警告。

我也尝试过在根目录下使用index.html文件,但那也是不成功的。

在这里你可以看到github repo万一有什么帮助。

我试图玩paginate_path以及index.html文件。任何帮助,将不胜感激!

具体错误信息是:

Pagination: Pagination is enabled, but I couldn't find an index.html page to use as the pagination template. Skipping pagination. 

任何帮助,将不胜感激。

回答

0

index.hmtl一定不能为空。分页模板文件(如paginatin_path称应包含的代码来生成与帖子列表中的每个页面,docs表明,创建blog/index.html

--- 
layout: default 
title: My Blog 
--- 

<!-- This loops through the paginated posts --> 
{% for post in paginator.posts %} 
    <h1><a href="{{ post.url }}">{{ post.title }}</a></h1> 
    <p class="author"> 
    <span class="date">{{ post.date }}</span> 
    </p> 
    <div class="content"> 
    {{ post.content }} 
    </div> 
{% endfor %} 

<!-- Pagination links --> 
<div class="pagination"> 
    {% if paginator.previous_page %} 
    <a href="{{ paginator.previous_page_path }}" class="previous">Previous</a> 
    {% else %} 
    <span class="previous">Previous</span> 
    {% endif %} 
    <span class="page_number ">Page: {{ paginator.page }} of {{ paginator.total_pages }}</span> 
    {% if paginator.next_page %} 
    <a href="{{ paginator.next_page_path }}" class="next">Next</a> 
    {% else %} 
    <span class="next ">Next</span> 
    {% endif %} 
</div>