Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate at least one page, issue #52 #53

merged 2 commits into from Dec 2, 2017


Copy link

@ibrado ibrado commented Nov 30, 2017

In cases where there are no posts (fresh site) or all the posts are hidden, no index.html is generated at the document root, leading to 404 errors from many/most hosting providers. This patch makes paginate-v2 always generate at least 1 page.

This fixes issue #52

# In case there are no (visible) posts, generate the index file anyway
if total_pages == 0
total_pages = 1

This comment has been minimized.


ashmaroli Dec 1, 2017

in one line.

total_pages = 1 if

This comment has been minimized.


ibrado Dec 1, 2017
Author Contributor

Ok! Those were actually the first lines of Ruby I'd ever written... 😊

Copy link

@sverrirs sverrirs commented Dec 2, 2017

Now that is an excellent fix :) short and sweet !

@sverrirs sverrirs merged commit ebdd42f into sverrirs:master Dec 2, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
@ibrado ibrado deleted the ibrado:generate-index-for-no-items branch Dec 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants