jekylljekyll-paginator

jekyll Multiple pagination on one page


hello everyone i am new to github,jekyll and ruby and maybe this question is already answered but being a newbie it's hard for me to resolve the problem.

i am trying to put multiple paginations on a single page i.e. say i have two authors posting their content on the blog so i created a division for each of them and want pagination for each of them individually.So the current code is something like this:

<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
            {% for post in paginator.posts %}
                {% if post.author contains "NAME OF AUTHOR 1" %}
                <div class="post-preview">
                   <a href="{{ post.url }}">
                    <h2 class="post-title">
                        {{ post.title }}
                    </h2>
                    <h3 class="post-subtitle">
                        {{ post.description }}
                    </h3>
                   </a>
                  <p class="post-meta">Posted by <a href="#">{{ post.author }}</a> {{ post.date | date_to_string }}</p>
                </div>
                <hr>
                {% endif %}
            {% endfor %}

            <!-- Pager -->
          {% if paginator.total_pages > 1 %}
            <ul class="pager">
                {% if paginator.previous_page %}
                <li class="previous">
                    <a href="{{ paginator.previous_page_path | prepend: site.url | replace: '//', '/' }}">&larr; Newer Posts</a>
                </li>
                {% endif %}
                {% if paginator.next_page %}
                <li class="next">
                    <a href="{{ paginator.next_page_path | prepend: site.url | replace: '//', '/' }}">Older Posts &rarr;</a>
                </li>
                {% endif %}
            </ul>
         {% endif %}
        </div>

        <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
            {% for post in paginator.posts %}
                {% if post.author contains "NAME OF AUTHOR2" %}
                <div class="post-preview">
                   <a href="{{ post.url | prepend: site.url }}">
                    <h2 class="post-title">
                        {{ post.title }}
                    </h2>
                    <h3 class="post-subtitle">
                        {{ post.description }}
                    </h3>
                   </a>
                  <p class="post-meta">Posted by <a href="#">{{ post.author }}</a> {{ post.date | date_to_string }}</p>
                </div>
                <hr>
                {% endif %}
            {% endfor %}
                <!-- Pager -->
            {% if paginator.total_pages > 1 %}
            <ul class="pager">
                {% if paginator.previous_page %}
                <li class="previous">
                    <a href="{{ paginator.previous_page_path | prepend: site.url | replace: '//', '/' }}">&larr; Newer Posts</a>
                </li>
                {% endif %}
                {% if paginator.next_page %}
                <li class="next">
                    <a href="{{ paginator.next_page_path | prepend: site.url | replace: '//', '/' }}">Older Posts &rarr;</a>
                </li>
                {% endif %}
            </ul>
            {% endif %}
        </div>

Also under _config.yml paginate is set to 3.

I have used jekyll with bootstrap(if am correct not jekyll-bootstrap) and followed a pretty simple tutorial ,also the file structure is also very simple.

thanks for your help i have read many documentation and many posts(always bound to screwup) before posting this so thanks to everyone.

Also, the blog is hosted at http://neorblog.in and github repositories at https://github.com/neortls007idev/Blog

Also the repo is not currently commited as per the above code.


Solution

  • Pagination is for all posts. You cannot have a pagination for posts where author == NeoR.

    You still have the solution to create a generator plugin. And yes, github pages doesn't accept foreign plugin for security reasons.

    But, simply pushing to github is not the only workflow available. You can try this.