Taxonomies can now be provided as a single string value if there is only one in frontmatter (tag = "val" vs tag = ["val"])

This commit is contained in:
spf13
2014-09-05 09:29:01 -04:00
parent 1b7f18e391
commit 4bb5e326db
3 changed files with 22 additions and 8 deletions

View File

@@ -535,13 +535,14 @@ func (s *Site) assembleTaxonomies() {
}
if vals != nil {
v, ok := vals.([]string)
if ok {
if v, ok := vals.([]string); ok {
for _, idx := range v {
x := WeightedPage{weight.(int), p}
s.Taxonomies[plural].Add(idx, x)
}
} else if v, ok := vals.(string); ok {
x := WeightedPage{weight.(int), p}
s.Taxonomies[plural].Add(v, x)
} else {
jww.ERROR.Printf("Invalid %s in %s\n", plural, p.File.FileName)
}