Problems with Paginate

Alright, so locally, I got paginate to work well.

However, when published to github pages, the post won’t show.


Any suggestions?

I don’t use the paginate plugin so I am not sure, but maybe it doesn’t like that you have the code to display it in the layout rather than the index.html file? try removing it from the layout and adding it into the index.html file.

When I have played with it it seemed picky about what file had the code to display it.

I don’t quite understand how that would work. The code needs to be in the content section of the html.

the index.html is the content - right now you have nothing in the index.html file, everything is in the layout. Put the paginate stuff in the index.html, delete it from the layout and see if it works.The layout will suck in the index.html content and generate the new index.html file.

In your layout, remove this:

{% for post in paginator.posts %}
		<h1><a href="{{ post.url }}">{{ post.title }}</a></h1>
		<h2>{{ | date: "%A, %B %d, %Y" }}</h2>
		<section>{{ post.content }}</section>
		{% endfor %}

			{% if paginator.total_posts > 5 %}
				{% if paginator.previous_page %}
					<a href="{{ paginator.previous_page_path }}">Previous</a>
				{% else %}
				{% endif %}

				<span>Page: {{ }} of {{ paginator.total_pages }}</span>

				{% if paginator.next_page %}
					<a href="{{ paginator.next_page_path }}">Next</a>
				{% else %}
				{% endif %}
			{% endif %}

and replace it with {{content}} instead

and then put that bit removed above into the index.html.

I think I copied the correct portion, but you get the idea.

Generally speaking the layout files will have a {{content}} tag in them, that is what gets the info from the file that called the layout.

For me the layout for a default page is like this:

{% include header.html %}
<main class="site-content">{{ content }}</main>
{% include footer.html %}

the header include has head info, the footer, well, footer info. Inbetween is the page content for that particular page/file.

I think the problem is you have two index files in your site root. Remove and keep index.html and give it another try.

1 Like

haha didn’t even see that!

Oh wow, I completely forgot about that Thanks!