mirror of
				https://github.com/gohugoio/hugo.git
				synced 2024-05-11 05:54:58 +00:00 
			
		
		
		
	tpl/collections: Add group template func
This extends the page grouping in Hugo with a template function that allows for ad-hoc grouping.
A made-up example:
```
{{ $cool := where .Site.RegularPages "Params.cool" true | group "cool" }}
{{ $blue := where .Site.RegularPages "Params.blue" true | group "blue" }}
{{ $paginator := .Paginate (slice $cool $blue) }}
```
Closes #4865
			
			
This commit is contained in:
		@@ -23,6 +23,7 @@ import (
 | 
			
		||||
 | 
			
		||||
	"github.com/gohugoio/hugo/media"
 | 
			
		||||
 | 
			
		||||
	"github.com/gohugoio/hugo/common/collections"
 | 
			
		||||
	"github.com/gohugoio/hugo/common/maps"
 | 
			
		||||
 | 
			
		||||
	"github.com/gohugoio/hugo/langs"
 | 
			
		||||
@@ -70,6 +71,8 @@ var (
 | 
			
		||||
 | 
			
		||||
	// Assert that it implements the interface needed for related searches.
 | 
			
		||||
	_ related.Document = (*Page)(nil)
 | 
			
		||||
 | 
			
		||||
	_ collections.Grouper = Page{}
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user