2017-04-19 47 views
0

檢查了任何可能性,我認爲我可能錯過了,但仍然無法讓分頁工作。如果有人能幫忙,我會非常感激。Jekyll Paginate無法正常工作

  • 紅寶石版本是ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
  • 化身版本是jekyll 3.4.3
  • gems: [jekyll-paginate]_config.yml
  • {%for article in paginator.posts%}被添加在代碼
  • 輸出 gem list

用於:

*** LOCAL GEMS *** 

addressable (2.5.1) 
bigdecimal (default: 1.3.0) 
coffee-script (2.4.1) 
coffee-script-source (1.11.1) 
colorator (1.1.0) 
did_you_mean (1.1.0) 
execjs (2.7.0) 
ffi (1.9.18) 
forwardable-extended (2.6.0) 
io-console (default: 0.4.6) 
jekyll (3.4.3) 
jekyll-coffeescript (1.0.2) 
jekyll-paginate (1.1.0) 
jekyll-paginate-category (0.1.2) 
jekyll-sass-converter (1.5.0) 
jekyll-watch (1.5.0) 
json (default: 2.0.2) 
kramdown (1.13.2) 
liquid (3.0.6) 
listen (3.0.8) 
mercenary (0.3.6) 
minitest (5.10.1) 
net-telnet (0.1.1) 
openssl (default: 2.0.3) 
pathutil (0.14.0) 
power_assert (0.4.1) 
psych (default: 2.2.2) 
public_suffix (2.0.5) 
rake (12.0.0) 
rb-fsevent (0.9.8) 
rb-inotify (0.9.8) 
rdoc (default: 5.0.0) 
rouge (1.11.1) 
safe_yaml (1.0.4) 
sass (3.4.23) 
test-unit (3.2.3) 
xmlrpc (0.2.1) 
+0

[安裝Ruby寶石的可能的複製不工作與家庭釀造](http://stackoverflow.com/q/6482738/1165509) – marcanuy

+0

是的,我讀了這篇文章,但並沒有真正幫助我的情況。 – edgaryp

回答

0

嘗試:

1 Make命令用於安裝分頁

sudo的創業板安裝哲基爾分頁

2-配置_config.yml:

添加插件jekyll-paginate

添加變量PAGINATE:5paginate_path:在索引頁: 「/博客/頁次/」

插入代碼:

<!-- 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>