{"id":"887557f00187e549","repo":"gohugoio/hugo","slug":"pagination-not-supported-for-this-page","errorCode":null,"errorMessage":"pagination not supported for this page","messagePattern":"pagination not supported for this page","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/page__output.go","lineNumber":28,"sourceCode":"// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage hugolib\n\nimport (\n\t\"fmt\"\n\t\"path\"\n\t\"strings\"\n\n\t\"github.com/gohugoio/hugo/identity\"\n\t\"github.com/gohugoio/hugo/output\"\n\t\"github.com/gohugoio/hugo/resources/page\"\n\t\"github.com/gohugoio/hugo/resources/resource\"\n)\n\nvar paginatorNotSupported = page.PaginatorNotSupportedFunc(func() error {\n\treturn fmt.Errorf(\"pagination not supported for this page\")\n})\n\nfunc newPageOutput(\n\tps *pageState,\n\tpp pagePaths,\n\tf output.Format,\n\trender bool,\n) *pageOutput {\n\tvar targetPathsProvider targetPathsHolder\n\tvar linksProvider resource.ResourceLinksProvider\n\n\tft, found := pp.targetPaths[f.Name]\n\tif !found {\n\t\t// Link to the main output format\n\t\tft = pp.targetPaths[pp.firstOutputFormat.Format.Name]\n\t}\n\ttargetPathsProvider = ft\n\tlinksProvider = ft","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/hugolib/page__output.go#L10-L46","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Only call .Paginate/.Paginator in list templates (home, section, taxonomy, term) — move the pagination into layouts/list.html, layouts/section.html, etc.","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 }}`.","For non-paginating contexts, list pages directly with `.Pages` or `first N .Pages` instead of a paginator.","Ensure you paginate only in the HTML output format template, not RSS/JSON variants."],"exampleFix":"{{/* layouts/page.html before */}}\n{{ range (.Paginate .Site.RegularPages).Pages }}...{{ end }}\n{{/* layouts/page.html after */}}\n{{ range first 10 .Site.RegularPages }}...{{ end }}","handlingStrategy":"type-guard","validationCode":"{{/* only paginate list-like pages */}}\n{{ if or .IsHome .IsSection (eq .Kind \"taxonomy\") (eq .Kind \"term\") }}\n  {{ $p := .Paginate .Pages }}\n{{ end }}","typeGuard":"{{/* template-level guard: check kind before calling .Paginator/.Paginate */}}\n{{ $canPaginate := in (slice \"home\" \"section\" \"taxonomy\" \"term\") .Kind }}","tryCatchPattern":null,"preventionTips":["Call .Paginate/.Paginator only in list templates (home, section, taxonomy, term) — never in layouts/page.html","Guard shared partials with a .Kind check before paginating","Cover every layout that paginates with an integration test rendering a regular page too"],"tags":["hugo","pagination","templates","page-kinds"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}