Jekyll paginate blog as subdirectory

前端 未结 2 1117
花落未央
花落未央 2021-01-14 06:50

I\'m using Jekyll for a static site and I\'m trying to generate the blog as a subdirectory/subfolder:

http://example.com/blog

In the direct

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-14 07:12

    I found a fix via this page Basically it involves a bit of a hack to figure out if you are on the nth page of the blog and then includes a file that pulls in you blog section.

    Create a file in _includes/custom/ called pagination. In that have your pagination code

    
    {% for post in paginator.posts %}
      

    {{ post.title }}

    {{ post.date }}

    {{ post.content }}
    {% endfor %}

    Now in your _layout/index.html add

    {% if paginator.page != 1 %}
    {% include custom/pagination %}
    {% else %}
    The original content of index
    {% endif %}
    

提交回复
热议问题