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

Add proper pagination support. #10

Merged
merged 2 commits into from
Oct 23, 2015
Merged

Conversation

nithinphilips
Copy link
Contributor

This commit adds pagination support introduces in recent versions of Hugo. See gohugoio/hugo#96

Related to issue #9

The CSS is from Bootstrap 3 with colors adjusted to match the default lanyon-hugo theme. It may need adjustment.

@tummychow
Copy link
Owner

Lanyon already provides CSS rules for pagination buttons (as shown in the stub implementation from many moons ago). I would rather see an implementation that uses those, rather than pulling in new CSS rules to support the hugo internal template.

@ace7
Copy link

ace7 commented Sep 24, 2015

@nithinphilips
Agree with @tummychow , based on your PR, just revert lanyon.css, change pagination div in index.html to the following will be fine.

<div class="pagination">
  {{ if $paginator.HasNext }}
  <a class="pagination-item older" href="{{ $paginator.Next.URL }}">Older</a>
  {{ else }}
  <span class="pagination-item older">Older</span>
  {{ end }}

  {{ if $paginator.HasPrev }}
  <a class="pagination-item newer" href="{{ $paginator.Prev.URL }}">Newer</a>
  {{ else }}
  <span class="pagination-item newer">Newer</span>
  {{ end }}
</div>

@nithinphilips
Copy link
Contributor Author

@tummychow @ace7 Makes sense. Let me rework this.

ryan-robeson added a commit to ryan-robeson/lanyon-hugo that referenced this pull request Oct 11, 2015
Added pagination support based on the work of @nithinphilips and the
comment from @ace7 on his pull request (tummychow#10).
@tummychow
Copy link
Owner

ping @nithinphilips , just wanted to check if you're still working on this.

@nithinphilips
Copy link
Contributor Author

I've updated the pull request. Reverted changes to lanyon.css. Modified index.html per @ace7's suggestion.

I tested on a simple site with 21 pages. Hugo created 3 index pages (10 posts max/pg):

/

Older Newer
/page/2/ Gray

/page/2

Older Newer
/page/3/ /

/page/3

Older Newer
Gray /page/2

tummychow added a commit that referenced this pull request Oct 23, 2015
@tummychow tummychow merged commit f970b59 into tummychow:master Oct 23, 2015
@tummychow
Copy link
Owner

👍 great contribution, thanks!

@tummychow tummychow mentioned this pull request Oct 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants