diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-01-31 16:19:52 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-01-31 16:54:34 +0100 |
commit | 6c3b6ba3e6ccc220cbca9cc83fab78db0a78604e (patch) | |
tree | 0df9f01f7c36809da4e0e2274f32df6cdd4a7223 /resources | |
parent | 4d98b0ed6a8aa4219fcc089228446cc480b31862 (diff) | |
download | hugo-6c3b6ba3e6ccc220cbca9cc83fab78db0a78604e.tar.gz hugo-6c3b6ba3e6ccc220cbca9cc83fab78db0a78604e.zip |
Improve error message when attempting to paginate from a single page template
Fixes #11953
Diffstat (limited to 'resources')
-rw-r--r-- | resources/page/pagination.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/resources/page/pagination.go b/resources/page/pagination.go index 9113b6062..4beb96e50 100644 --- a/resources/page/pagination.go +++ b/resources/page/pagination.go @@ -32,6 +32,18 @@ type PaginatorProvider interface { Paginate(pages any, options ...any) (*Pager, error) } +var _ PaginatorProvider = (*PaginatorNotSupportedFunc)(nil) + +type PaginatorNotSupportedFunc func() error + +func (f PaginatorNotSupportedFunc) Paginate(pages any, options ...any) (*Pager, error) { + return nil, f() +} + +func (f PaginatorNotSupportedFunc) Paginator(options ...any) (*Pager, error) { + return nil, f() +} + // Pager represents one of the elements in a paginator. // The number, starting on 1, represents its place. type Pager struct { |