# Turn off pagination

**URL:** <https://discourse.gohugo.io/t/turn-off-pagination/9961>\
**Category:** support\
**Tags:** pagination\
**Created:** [January 11, 2018, 5:25pm UTC](https://discourse.gohugo.io/t/turn-off-pagination/9961 "2018-01-11T17:25:03Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_nm](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/_nm/32/7662_2.png) [@\_nm](https://discourse.gohugo.io/u/_nm)\
**Post date:** [January 11, 2018, 5:25pm UTC](https://discourse.gohugo.io/t/turn-off-pagination/9961/1 "2018-01-11T17:25:03Z")

</div>

In my `config.toml` I’ve set `paginate = 99` because I have fewer than 99 pages and I do not want pagination pages. When I run `hugo`, the `public` directory contains a `page/1` directory. How do I tell `hugo` not to create the `page` directory. Looking at [gohugo.io/getting-started/configuration/](https://gohugo.io/getting-started/configuration/), the settings that might be related to a solution to this are these:

```toml
# Allows you to disable all page types and will render nothing related to 'kind';
# values = "page", "home", "section", "taxonomy", "taxonomyTerm", "RSS", "sitemap", "robotsTXT", "404"
disableKinds = []
 :   
# Pagination
paginate = 10
paginatePath = "page"

```

I tried setting `paginate = 0` but that produced this error:

> error calling Paginator: ‘paginate’ configuration setting must be positive to paginate

Is there a way to turn off pagination?

Thanks.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [January 11, 2018, 5:41pm UTC](https://discourse.gohugo.io/t/turn-off-pagination/9961/2 "2018-01-11T17:41:41Z")

</div>

> [@\_nm](#):
>
> Is there a way to turn off pagination?

Only by not using it in the templates.

---

<div class="post-metadata">

**Author:** ![BYVoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/byvoid/32/11204_2.png) [@BYVoid](https://discourse.gohugo.io/u/BYVoid)\
**Post date:** [April 26, 2020, 5:41pm UTC](https://discourse.gohugo.io/t/turn-off-pagination/9961/3 "2020-04-26T17:41:42Z")

</div>

Hi bep,

I tried to disable pagination for only “tags” Taxonomy.  
In my template I tried

```
{{ if and (.Paginator) (ne .Name "Tags") }}

```

With the code above, I managed to hide pagination bar in my tags page.

But Hugo still generates pagination pages for tags.

I also tried a separate `tag.terms.html` without any reference to Paginator, but it was the same.

How can I disable the generation of tags pages only?

---

<div class="post-metadata">

**Author:** ![ju52](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ju52/32/6749_2.png) [@ju52](https://discourse.gohugo.io/u/ju52)\
**Post date:** [April 26, 2020, 5:53pm UTC](https://discourse.gohugo.io/t/turn-off-pagination/9961/4 "2020-04-26T17:53:51Z")

</div>

Create ./tags under layout and copy list.html from the \_default directory.  
Remove paging from the copied templates.

---

<div class="post-metadata">

**Author:** ![BYVoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/byvoid/32/11204_2.png) [@BYVoid](https://discourse.gohugo.io/u/BYVoid)\
**Post date:** [April 27, 2020, 12:38pm UTC](https://discourse.gohugo.io/t/turn-off-pagination/9961/5 "2020-04-27T12:38:35Z")

</div>

Hi ju52,

I tried your suggestions, but it did not work. I still see `/tags/pages/...` in the generated site, though there is no `. Paginator` reference from `layouts/tags/list.html` (therefore no pagination bar on the page).

This is basically the same as a separate `tag.terms.html`.

---

<div class="post-metadata">

**Author:** ![ju52](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ju52/32/6749_2.png) [@ju52](https://discourse.gohugo.io/u/ju52)\
**Post date:** [April 27, 2020, 3:17pm UTC](https://discourse.gohugo.io/t/turn-off-pagination/9961/6 "2020-04-27T15:17:39Z")

</div>

list.html is used to list all tags and to list all pages for a tag.

I use **layout/tags/terms.html.html** to list all tags - looks like this

```
 {{ define "main" }}
    <header>	<h1>{{ .Page.Title }}</h1></header>
    <article>
    {{range .Data.Terms.Alphabetical }} 
 	    <a href={{ .Page.RelPermalink }} title="Pages for &quot;{{.Page.Title}}&quot; ">{{.Page.Title}}</a>&nbsp;<sup class=b>{{.Count}}</sup>
	{{ end}}
    </article>
 {{ end }} 

```

The list of all pages for a tag is rendered with **list.html.html**  
I used this names, bc hugo looks first at it.

---

<div class="post-metadata">

**Author:** ![Rise](https://avatars.discourse-cdn.com/v4/letter/r/958977/32.png) [@Rise](https://discourse.gohugo.io/u/Rise)\
**Post date:** [May 26, 2020, 4:21am UTC](https://discourse.gohugo.io/t/turn-off-pagination/9961/7 "2020-05-26T04:21:01Z")

</div>

Hi, I met with the same problem. So how did you solve this?  
I tend to regard this as a bug of Hugo.

Even I replaced the `range .Paginator.Pages` with `range .Pages` in `terms.html`, it still generates pagination pages.

---

<div class="post-metadata">

**Author:** ![truffles](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@truffles](https://discourse.gohugo.io/u/truffles)\
**Post date:** [September 5, 2020, 9:12am UTC](https://discourse.gohugo.io/t/turn-off-pagination/9961/8 "2020-09-05T09:12:31Z")

</div>

Workaround:

- Add these lines to config.toml:

- Create a build.sh within the project root folder which you will be using for generating the project:

- Execute:

There you go. Execute `./build.sh` whenever you build the project.  
[BONUS] I also use [tidy](https://www.html-tidy.org/) to clean up my html files by adding this line to build.sh:

```
find public -name '*.html' -type f -print -exec tidy --indent true --indent-spaces 2 --tidy-mark false -mq '{}' \;
```

---

<div class="post-metadata">

**Author:** ![jeremie](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@jeremie](https://discourse.gohugo.io/u/jeremie)\
**Post date:** [August 6, 2021, 11:51pm UTC](https://discourse.gohugo.io/t/turn-off-pagination/9961/9 "2021-08-06T23:51:33Z")

</div>

I faced the same problem, not with tags, but with just pages from a section in a list.html layout. I had a section subdirectory with just one file “1”.

As bep indicated, that’s the use of .Paginator that was causing the issue

I replaced:

```auto
{{ range .Paginator.Pages }}`

```

by:

```auto
{{ $section := .Section }}
{{ range where .Pages "Section" $section }}

```

and it fixed the issue.

(I know that it is not directly related, but that the first post about turning off pagination that comes out, so I thought it might help)

---

<div class="post-metadata">

**Author:** ![SmithWillSuffice](https://avatars.discourse-cdn.com/v4/letter/s/6f9a4e/32.png) [@SmithWillSuffice](https://discourse.gohugo.io/u/SmithWillSuffice)\
**Post date:** [November 11, 2022, 7:34am UTC](https://discourse.gohugo.io/t/turn-off-pagination/9961/10 "2022-11-11T07:34:12Z")

</div>

In “config.toml” use,

```auto
paginate = 99

```

or some other large enough number. But **make sure this setting is not underneath one of the other hash tables** like [menu] or [parameters]. It needs to be a line in the top level section of the toml.

If this does not work then it indicates your layouts and other templates are probably mis-configured. Try some other theme or hugo template site in this case first, the idea is you can get it working, then back track to find out where your old site went wrong.
