gohugoio/hugo · error

pagination not supported for this page

Error message

pagination not supported for this page

What it means

The error produced by the package-level paginatorNotSupported function in hugolib/page__output.go, installed as the Paginate/Paginator implementation on page outputs that cannot paginate. Hugo only supports pagination on node pages — home, section, taxonomy, and term pages — and only in their HTML output; calling .Paginate or .Paginator anywhere else hits this stub.

Source

Thrown at hugolib/page__output.go:28

// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package hugolib

import (
	"fmt"
	"path"
	"strings"

	"github.com/gohugoio/hugo/identity"
	"github.com/gohugoio/hugo/output"
	"github.com/gohugoio/hugo/resources/page"
	"github.com/gohugoio/hugo/resources/resource"
)

var paginatorNotSupported = page.PaginatorNotSupportedFunc(func() error {
	return fmt.Errorf("pagination not supported for this page")
})

func newPageOutput(
	ps *pageState,
	pp pagePaths,
	f output.Format,
	render bool,
) *pageOutput {
	var targetPathsProvider targetPathsHolder
	var linksProvider resource.ResourceLinksProvider

	ft, found := pp.targetPaths[f.Name]
	if !found {
		// Link to the main output format
		ft = pp.targetPaths[pp.firstOutputFormat.Format.Name]
	}
	targetPathsProvider = ft
	linksProvider = ft

View on GitHub ↗ (pinned to 8a468df065)

Solutions

  1. Only call .Paginate/.Paginator in list templates (home, section, taxonomy, term) — move the pagination into layouts/list.html, layouts/section.html, etc.
  2. If a shared partial needs it, guard the call: `{{ if .Paginate }}` won't work (it errors), so branch on kind instead: `{{ if in (slice "home" "section" "taxonomy" "term") .Kind }}...{{ end }}`.
  3. For non-paginating contexts, list pages directly with `.Pages` or `first N .Pages` instead of a paginator.
  4. Ensure you paginate only in the HTML output format template, not RSS/JSON variants.

Example fix

{{/* layouts/page.html before */}}
{{ range (.Paginate .Site.RegularPages).Pages }}...{{ end }}
{{/* layouts/page.html after */}}
{{ range first 10 .Site.RegularPages }}...{{ end }}
Defensive patterns

Strategy: type-guard

Validate before calling

{{/* only paginate list-like pages */}}
{{ if or .IsHome .IsSection (eq .Kind "taxonomy") (eq .Kind "term") }}
  {{ $p := .Paginate .Pages }}
{{ end }}

Type guard

{{/* template-level guard: check kind before calling .Paginator/.Paginate */}}
{{ $canPaginate := in (slice "home" "section" "taxonomy" "term") .Kind }}

Prevention

When it happens

Trigger: Calling `.Paginate ...` or `.Paginator` in a template rendering a regular content page (layouts/page.html or a single-page layout), inside a shortcode/partial executed in a regular page's context, or on a non-HTML output format of a list page.

Common situations: Reusing a list partial that calls .Paginate from a single-page template; themes that paginate in a partial invoked from both list and single contexts; calling .Paginate on a page fetched via .GetPage from another page's template; paginating in RSS/JSON output format templates.

Related errors


AI-assisted analysis of gohugoio/hugo@8a468df065 (2026-07-31). Data as JSON: /data/errors/887557f00187e549.json. Report an issue: GitHub ↗.