mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
Add a more flexible filename identifier scheme that also allows setting roles and versions (#14754)
Fixes #14750
This commit is contained in:
committed by
GitHub
parent
9747724222
commit
ce2a156a4e
@@ -812,6 +812,32 @@ func (s *IntSetsBuilder) WithLanguageIndices(idxs ...int) *IntSetsBuilder {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *IntSetsBuilder) WithVersionIndices(idxs ...int) *IntSetsBuilder {
|
||||
if len(idxs) == 0 {
|
||||
return s
|
||||
}
|
||||
if s.s.versions == nil {
|
||||
s.s.versions = hmaps.NewOrderedIntSet()
|
||||
}
|
||||
for _, i := range idxs {
|
||||
s.s.versions.Set(i)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *IntSetsBuilder) WithRoleIndices(idxs ...int) *IntSetsBuilder {
|
||||
if len(idxs) == 0 {
|
||||
return s
|
||||
}
|
||||
if s.s.roles == nil {
|
||||
s.s.roles = hmaps.NewOrderedIntSet()
|
||||
}
|
||||
for _, i := range idxs {
|
||||
s.s.roles.Set(i)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *IntSetsBuilder) WithDefaultsAndAllLanguagesIfNotSet() *IntSetsBuilder {
|
||||
s.s.setDefaultsAndAllLAnguagesIfNotSet(s.cfg)
|
||||
return s
|
||||
|
||||
Reference in New Issue
Block a user