mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
@@ -37,6 +37,9 @@ type PageMatcher struct {
|
||||
|
||||
// A Glob pattern matching the Page's language, e.g. "{en,sv}".
|
||||
Lang string
|
||||
|
||||
// A Glob pattern matching the Page's Environment, e.g. "{production,development}".
|
||||
Environment string
|
||||
}
|
||||
|
||||
// Matches returns whether p matches this matcher.
|
||||
@@ -67,6 +70,13 @@ func (m PageMatcher) Matches(p Page) bool {
|
||||
}
|
||||
}
|
||||
|
||||
if m.Environment != "" {
|
||||
g, err := glob.GetGlob(m.Environment)
|
||||
if err == nil && !g.Match(p.Site().Hugo().Environment) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user