mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +02:00
Improve error message when attempting to paginate from a single page template
Fixes #11953
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user