summaryrefslogtreecommitdiffstats
path: root/resources/page/pages.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-04-21 10:59:13 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-04-27 23:53:56 +0200
commitfa80fe3c8ab523846178f94fdc65c997d8eef10c (patch)
tree4266bc03b2f594ffdb10b87d7956d2ed956f4bec /resources/page/pages.go
parent11047534e47f2f2c710a6f8504d7415ff27d6024 (diff)
Some godoc adjustments and image struct renames
Diffstat (limited to 'resources/page/pages.go')
-rw-r--r--resources/page/pages.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/resources/page/pages.go b/resources/page/pages.go
index 4db6a4f68..f47af5114 100644
--- a/resources/page/pages.go
+++ b/resources/page/pages.go
@@ -22,9 +22,11 @@ import (
"github.com/gohugoio/hugo/resources/resource"
)
-// Pages is a slice of pages. This is the most common list type in Hugo.
+// Pages is a slice of Page objects. This is the most common list type in Hugo.
type Pages []Page
+// String returns a string representation of the list.
+// For internal use.
func (ps Pages) String() string {
return fmt.Sprintf("Pages(%d)", len(ps))
}
@@ -37,7 +39,8 @@ func (ps Pages) shuffle() {
}
}
-// ToResources wraps resource.ResourcesConverter
+// ToResources wraps resource.ResourcesConverter.
+// For internal use.
func (pages Pages) ToResources() resource.Resources {
r := make(resource.Resources, len(pages))
for i, p := range pages {
@@ -86,10 +89,12 @@ func ToPages(seq any) (Pages, error) {
return nil, fmt.Errorf("cannot convert type %T to Pages", seq)
}
+// Group groups the pages in in by key.
+// This implements collections.Grouper.
func (p Pages) Group(key any, in any) (any, error) {
pages, err := ToPages(in)
if err != nil {
- return nil, err
+ return PageGroup{}, err
}
return PageGroup{Key: key, Pages: pages}, nil
}
@@ -100,6 +105,7 @@ func (p Pages) Len() int {
}
// ProbablyEq wraps compare.ProbablyEqer
+// For internal use.
func (pages Pages) ProbablyEq(other any) bool {
otherPages, ok := other.(Pages)
if !ok {