mirror of
https://github.com/gohugoio/hugo.git
synced 2024-09-13 01:12:31 -04:00
writing indexes under more configuration conditions
This commit is contained in:
parent
ad34be9d77
commit
af1acfbce7
2 changed files with 45 additions and 44 deletions
|
@ -146,6 +146,8 @@ func InitializeConfig() {
|
|||
if VerboseLog {
|
||||
jww.SetLogThreshold(jww.LevelDebug)
|
||||
}
|
||||
|
||||
jww.INFO.Println("Using config file:", viper.ConfigFileUsed())
|
||||
}
|
||||
|
||||
func build(watches ...bool) {
|
||||
|
|
|
@ -302,7 +302,10 @@ func (s *Site) BuildSiteMeta() (err error) {
|
|||
s.Indexes = make(IndexList)
|
||||
s.Sections = make(Index)
|
||||
|
||||
for _, plural := range viper.GetStringMapString("Indexes") {
|
||||
indexes := viper.GetStringMapString("Indexes")
|
||||
jww.INFO.Printf("found indexes: %#v\n", indexes)
|
||||
|
||||
for _, plural := range indexes {
|
||||
s.Indexes[plural] = make(Index)
|
||||
for _, p := range s.Pages {
|
||||
vals := p.GetParam(plural)
|
||||
|
@ -421,8 +424,7 @@ func (s *Site) RenderPages() (err error) {
|
|||
func (s *Site) RenderIndexes() (err error) {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
indexes, ok := viper.Get("Indexes").(map[string]string)
|
||||
if ok {
|
||||
indexes := viper.GetStringMapString("Indexes")
|
||||
for sing, pl := range indexes {
|
||||
for key, oo := range s.Indexes[pl] {
|
||||
wg.Add(1)
|
||||
|
@ -453,7 +455,6 @@ func (s *Site) RenderIndexes() (err error) {
|
|||
}(key, oo, sing, pl)
|
||||
}
|
||||
}
|
||||
}
|
||||
wg.Wait()
|
||||
return nil
|
||||
}
|
||||
|
@ -462,8 +463,7 @@ func (s *Site) RenderIndexesIndexes() (err error) {
|
|||
layout := "indexes/indexes.html"
|
||||
if s.Tmpl.Lookup(layout) != nil {
|
||||
|
||||
indexes, ok := viper.Get("Indexes").(map[string]string)
|
||||
if ok {
|
||||
indexes := viper.GetStringMapString("Indexes")
|
||||
for singular, plural := range indexes {
|
||||
n := s.NewNode()
|
||||
n.Title = strings.Title(plural)
|
||||
|
@ -480,7 +480,6 @@ func (s *Site) RenderIndexesIndexes() (err error) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue