Skip to content

Commit

Permalink
hugolib: Fix benchmark for YAML front matter
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Apr 5, 2019
1 parent 9502955 commit e2dc432
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions hugolib/site_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ tags = %s

pageTemplateYAML := `---
title: "%s"
tags:
%s
tags: %s
---
%s
Expand Down Expand Up @@ -255,8 +254,6 @@ weight = %d
tags[i] = fmt.Sprintf("Hugo %d", i+1)
}

var tagsStr string

if cfg.Shortcodes {
contentPagesContent = [3]string{
someMarkdown,
Expand Down Expand Up @@ -302,6 +299,8 @@ weight = %d
tagsSlice = tags[tagsStart : tagsStart+cfg.TagsPerPage]
}

var tagsStr string

if cfg.Frontmatter == "TOML" {
pageTemplate = pageTemplateTOML
tagsStr = "[]"
Expand All @@ -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)
}
Expand Down

0 comments on commit e2dc432

Please sign in to comment.