2017-08-17 49 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>