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
merged 2 commits into from Dec 2, 2017

Conversation

Projects
None yet
3 participants
@ibrado
Contributor

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
end

This comment has been minimized.

@ashmaroli

ashmaroli Dec 1, 2017

Contributor

in one line.

total_pages = 1 if total_pages.zero?

This comment has been minimized.

@ibrado

ibrado Dec 1, 2017

Contributor

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

@sverrirs

This comment has been minimized.

Owner

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

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@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