hugolib: Fix benchmark for YAML front matter
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 5 Apr 2019 06:44:14 +0000 (08:44 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 5 Apr 2019 06:52:58 +0000 (08:52 +0200)
hugolib/site_benchmark_test.go

index 7fb46235d011f96b458a20e3e4f3ff2b383ce8cb..8c5e07a523b0f1c6267f737904700dec010a3a71 100644 (file)
@@ -195,8 +195,7 @@ tags = %s
 
        pageTemplateYAML := `---
 title: "%s"
-tags:
-%s
+tags: %s
 ---
 %s
 
@@ -255,8 +254,6 @@ weight = %d
                tags[i] = fmt.Sprintf("Hugo %d", i+1)
        }
 
-       var tagsStr string
-
        if cfg.Shortcodes {
                contentPagesContent = [3]string{
                        someMarkdown,
@@ -302,6 +299,8 @@ weight = %d
                                                tagsSlice = tags[tagsStart : tagsStart+cfg.TagsPerPage]
                                        }
 
+                                       var tagsStr string
+
                                        if cfg.Frontmatter == "TOML" {
                                                pageTemplate = pageTemplateTOML
                                                tagsStr = "[]"
@@ -321,9 +320,11 @@ weight = %d
                                        contentFilename := fmt.Sprintf("page%d%s.md", j, fileLangCodeID)
 
                                        writeSource(b, fs, filepath.Join("content", fmt.Sprintf("sect%d", i), contentFilename), content)
+
                                }
 
                                content := fmt.Sprintf(pageTemplate, fmt.Sprintf("Section %d", i), "[]", contentPagesContent[rand.Intn(3)])
+
                                indexContentFilename := fmt.Sprintf("_index%s.md", fileLangCodeID)
                                writeSource(b, fs, filepath.Join("content", fmt.Sprintf("sect%d", i), indexContentFilename), content)
                        }