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

Support for pagination #96

Closed
spf13 opened this issue Oct 8, 2013 · 16 comments
Closed

Support for pagination #96

spf13 opened this issue Oct 8, 2013 · 16 comments
Assignees
Milestone

Comments

@spf13
Copy link
Contributor

spf13 commented Oct 8, 2013

No description provided.

@sekirocc
Copy link

Since it's a static site, Hugo should generate different html files to support next page, prev page. maybe index_page_1.html, index_page_2.html etc.

@rahul286
Copy link
Contributor

This is really nice idea.

For clean urls, it could be...

/public/section/index.html
/public/section/page/1/index.html --> redirect to /public/section/index.html
/public/section/page/2/index.html
/public/section/page/3/index.html

@Koenyn
Copy link

Koenyn commented Sep 2, 2014

Yeah I would really like this feature too.

@wallflower
Copy link

I saw this on Hugo Discuss, and thought I would place it here. Looks like a good strategy for pagination:
http://googlewebmastercentral.blogspot.ca/2014/02/infinite-scroll-search-friendly.html?m=1

Thoughts?

@curiouslychase
Copy link
Contributor

@spf13 [Steve], is anyone working on this issue?

@spf13
Copy link
Contributor Author

spf13 commented Sep 14, 2014

Yes. Well I'm planning on it for the next release.

@ghost
Copy link

ghost commented Nov 16, 2014

Any updates on this?

@kshcherban
Copy link

+1 must have feature

@azmelanar
Copy link

+1 waiting for this feature

@Fale
Copy link
Contributor

Fale commented Dec 14, 2014

+1 this is a must have feature :)

@JulienD
Copy link

JulienD commented Dec 16, 2014

+1 Also. This is the missing element from my point of view and also the reason why I haven't abandoned Octopress yet.

@bep
Copy link
Member

bep commented Dec 16, 2014

It's on my top wanted list as well (and I would love to contribute som development hours to it), but to scope it down, I guess it should work for (by some setting)

  • section list pages
  • taxonomy list pages

Any tips, hints, requirements?

@JulienD
Copy link

JulienD commented Dec 17, 2014

Same here, I tried to go deep into Hugo but didn't really find where to focus. Next try maybe :)

@thomasmodeneis
Copy link

+1

@bep
Copy link
Member

bep commented Dec 28, 2014

I opened up a discussion about an implementation mine of this:

http://discuss.gohugo.io/t/pagination-implementation-feedback-appreciated/519

The implementation is still a little unpolished, but works and it shouldn't be too long until PR time.

bep referenced this issue in bep/hugo Jan 16, 2015
A new configuration property `paginate` is added with default value `0`. This setting will generate the site with no pagination, as it is today.

Setting `paginate` to a positive value will split the list pages for sections and taxonomies into chunks of size of the `paginate` property.

`Data.Paginator` is provided as a template variable to help building a pager menu.

`Data.Paginator.Pages` contains the pages for "that page" and `Data.Pages` will (like today) contain all the pages.

The pages are built on the form:

```
[SECTION/TAXONOMY]/index.html
[SECTION/TAXONOMY]/page/1/index.html => redirect to  [SECTION/TAXONOMY]/index.html
[SECTION/TAXONOMY]/page/2/index.html
....
```

Fixes #96
bep referenced this issue in bep/hugo Jan 26, 2015
Two new configuration properties, `Paginate` (default `0`) and `PaginatePath` (default `page`) are added.

Setting `paginate` to a positive value will split the list pages for the home page, sections and taxonomies into chunks of size of the `paginate` property.

A `.Paginator` is provided to help building a pager menu.

There are two ways to configure a `.Paginator`:

1. The simplest way is just to call `.Paginator.Pages` from a template. It will contain the pages for "that page" (`.Data.Pages` will (like today) contain all the pages).
2. Select a sub-set of the pages with the available template functions and pass the slice to `.Paginate` : `{{ range (.Paginate (where .Data.Pages "Type" "post")).Pages }}`

**NOTE:** For a given Node, it's one of the options above. It's perfectly legitimate to iterate over the same pager more than once, but it's static and cannot change.

The `.Paginator` contains enough information to build a full-blown paginator interface.

The pages are built on the form (note: BLANK means no value, i.e. home page):

```
[SECTION/TAXONOMY/BLANK]/index.html
[SECTION/TAXONOMY/BLANK]/page/1/index.html => redirect to  [SECTION/TAXONOMY/BLANK]/index.html
[SECTION/TAXONOMY/BLANK]/page/2/index.html
....
```

Fixes #96
@bep bep closed this as completed Jan 26, 2015
bep added a commit that referenced this issue Jan 26, 2015
Two new configuration properties, `Paginate` (default `0`) and `PaginatePath` (default `page`) are added.

Setting `paginate` to a positive value will split the list pages for the home page, sections and taxonomies into chunks of size of the `paginate` property.

A `.Paginator` is provided to help building a pager menu.

There are two ways to configure a `.Paginator`:

1. The simplest way is just to call `.Paginator.Pages` from a template. It will contain the pages for "that page" (`.Data.Pages` will (like today) contain all the pages).
2. Select a sub-set of the pages with the available template functions and pass the slice to `.Paginate` : `{{ range (.Paginate (where .Data.Pages "Type" "post")).Pages }}`

**NOTE:** For a given Node, it's one of the options above. It's perfectly legitimate to iterate over the same pager more than once, but it's static and cannot change.

The `.Paginator` contains enough information to build a full-blown paginator interface.

The pages are built on the form (note: BLANK means no value, i.e. home page):

```
[SECTION/TAXONOMY/BLANK]/index.html
[SECTION/TAXONOMY/BLANK]/page/1/index.html => redirect to  [SECTION/TAXONOMY/BLANK]/index.html
[SECTION/TAXONOMY/BLANK]/page/2/index.html
....
```

Fixes #96
nithinphilips added a commit to nithinphilips/lanyon-hugo that referenced this issue Sep 21, 2015
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
Two new configuration properties, `Paginate` (default `0`) and `PaginatePath` (default `page`) are added.

Setting `paginate` to a positive value will split the list pages for the home page, sections and taxonomies into chunks of size of the `paginate` property.

A `.Paginator` is provided to help building a pager menu.

There are two ways to configure a `.Paginator`:

1. The simplest way is just to call `.Paginator.Pages` from a template. It will contain the pages for "that page" (`.Data.Pages` will (like today) contain all the pages).
2. Select a sub-set of the pages with the available template functions and pass the slice to `.Paginate` : `{{ range (.Paginate (where .Data.Pages "Type" "post")).Pages }}`

**NOTE:** For a given Node, it's one of the options above. It's perfectly legitimate to iterate over the same pager more than once, but it's static and cannot change.

The `.Paginator` contains enough information to build a full-blown paginator interface.

The pages are built on the form (note: BLANK means no value, i.e. home page):

```
[SECTION/TAXONOMY/BLANK]/index.html
[SECTION/TAXONOMY/BLANK]/page/1/index.html => redirect to  [SECTION/TAXONOMY/BLANK]/index.html
[SECTION/TAXONOMY/BLANK]/page/2/index.html
....
```

Fixes gohugoio#96
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.