mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
compare, hugolib, tpl: Add Eqer interface
And use it in `eq` and `ne` so `Page` values can be compared directly in the templates without thinking about it being a `Page` or a `PageOutput` wrapper. Fixes #3807
This commit is contained in:
@@ -38,6 +38,7 @@ import (
|
||||
"unicode/utf8"
|
||||
|
||||
bp "github.com/gohugoio/hugo/bufferpool"
|
||||
"github.com/gohugoio/hugo/compare"
|
||||
"github.com/gohugoio/hugo/source"
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
@@ -49,6 +50,10 @@ var (
|
||||
allKindsInPages = []string{KindPage, KindHome, KindSection, KindTaxonomy, KindTaxonomyTerm}
|
||||
|
||||
allKinds = append(allKindsInPages, []string{kindRSS, kindSitemap, kindRobotsTXT, kind404}...)
|
||||
|
||||
// Assert that it implements the Eqer interface.
|
||||
_ compare.Eqer = (*Page)(nil)
|
||||
_ compare.Eqer = (*PageOutput)(nil)
|
||||
)
|
||||
|
||||
const (
|
||||
|
Reference in New Issue
Block a user