Set detault for Paginate to 10

10 is a better default than 0, since no paginator pages will be created unles referenced by a `.Paginator`.

See #750
This commit is contained in:
bep 2015-01-26 15:26:19 +01:00
parent a6d22bcf7d
commit fb594fc6e0
3 changed files with 6 additions and 7 deletions

View file

@ -136,7 +136,7 @@ func InitializeConfig() {
viper.SetDefault("FootnoteAnchorPrefix", "") viper.SetDefault("FootnoteAnchorPrefix", "")
viper.SetDefault("FootnoteReturnLinkContents", "") viper.SetDefault("FootnoteReturnLinkContents", "")
viper.SetDefault("NewContentEditor", "") viper.SetDefault("NewContentEditor", "")
viper.SetDefault("Paginate", 0) viper.SetDefault("Paginate", 10)
viper.SetDefault("PaginatePath", "page") viper.SetDefault("PaginatePath", "page")
viper.SetDefault("Blackfriday", new(helpers.Blackfriday)) viper.SetDefault("Blackfriday", new(helpers.Blackfriday))

View file

@ -17,10 +17,12 @@ Hugo supports pagination for the home page, sections and taxonomies.
Pagination can be configured in the site configuration (e.g. `config.toml`): Pagination can be configured in the site configuration (e.g. `config.toml`):
* `Paginate` (default `0`) * `Paginate` (default `10`)
* `PaginatePath` (default `page`) * `PaginatePath` (default `page`)
Setting `Paginate` to a positive value will split the list pages for the home page, sections and taxonomies into chunks of that size.[^lazy] `PaginatePath` is used to adapt the `Url` to the pages in the paginator (the default setting will produce urls on the form `/page/1/`. Setting `Paginate` to a positive value will split the list pages for the home page, sections and taxonomies into chunks of that size. But note that the generation of the pagination pages for sections, taxonomies and home page is *lazy* -- the pages will not be created if not referenced by a `.Paginator` (see below).
`PaginatePath` is used to adapt the `Url` to the pages in the paginator (the default setting will produce urls on the form `/page/1/`.
## List the pages ## List the pages
@ -90,5 +92,4 @@ The pages are built on the following form (`BLANK` means no value):
.... ....
``` ```
[^lazy]: The generation of the pagination pages for sections, taxonomies and home page is *lazy* -- they will not be created if not referenced by a `.Paginator`.

View file

@ -1293,9 +1293,7 @@ func (s *Site) Stats() {
jww.FEEDBACK.Println(s.draftStats()) jww.FEEDBACK.Println(s.draftStats())
jww.FEEDBACK.Println(s.futureStats()) jww.FEEDBACK.Println(s.futureStats())
jww.FEEDBACK.Printf("%d pages created \n", len(s.Pages)) jww.FEEDBACK.Printf("%d pages created \n", len(s.Pages))
if viper.GetInt("paginate") > 0 { jww.FEEDBACK.Printf("%d paginator pages created \n", s.Info.paginationPageCount)
jww.FEEDBACK.Printf("%d paginator pages created \n", s.Info.paginationPageCount)
}
taxonomies := viper.GetStringMapString("Taxonomies") taxonomies := viper.GetStringMapString("Taxonomies")
for _, pl := range taxonomies { for _, pl := range taxonomies {