mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
hugolib: Fix benchmark for YAML front matter
This commit is contained in:
parent
950295516d
commit
e2dc432fe2
1 changed files with 5 additions and 4 deletions
|
@ -195,8 +195,7 @@ tags = %s
|
||||||
|
|
||||||
pageTemplateYAML := `---
|
pageTemplateYAML := `---
|
||||||
title: "%s"
|
title: "%s"
|
||||||
tags:
|
tags: %s
|
||||||
%s
|
|
||||||
---
|
---
|
||||||
%s
|
%s
|
||||||
|
|
||||||
|
@ -255,8 +254,6 @@ weight = %d
|
||||||
tags[i] = fmt.Sprintf("Hugo %d", i+1)
|
tags[i] = fmt.Sprintf("Hugo %d", i+1)
|
||||||
}
|
}
|
||||||
|
|
||||||
var tagsStr string
|
|
||||||
|
|
||||||
if cfg.Shortcodes {
|
if cfg.Shortcodes {
|
||||||
contentPagesContent = [3]string{
|
contentPagesContent = [3]string{
|
||||||
someMarkdown,
|
someMarkdown,
|
||||||
|
@ -302,6 +299,8 @@ weight = %d
|
||||||
tagsSlice = tags[tagsStart : tagsStart+cfg.TagsPerPage]
|
tagsSlice = tags[tagsStart : tagsStart+cfg.TagsPerPage]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var tagsStr string
|
||||||
|
|
||||||
if cfg.Frontmatter == "TOML" {
|
if cfg.Frontmatter == "TOML" {
|
||||||
pageTemplate = pageTemplateTOML
|
pageTemplate = pageTemplateTOML
|
||||||
tagsStr = "[]"
|
tagsStr = "[]"
|
||||||
|
@ -321,9 +320,11 @@ weight = %d
|
||||||
contentFilename := fmt.Sprintf("page%d%s.md", j, fileLangCodeID)
|
contentFilename := fmt.Sprintf("page%d%s.md", j, fileLangCodeID)
|
||||||
|
|
||||||
writeSource(b, fs, filepath.Join("content", fmt.Sprintf("sect%d", i), contentFilename), content)
|
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)])
|
content := fmt.Sprintf(pageTemplate, fmt.Sprintf("Section %d", i), "[]", contentPagesContent[rand.Intn(3)])
|
||||||
|
|
||||||
indexContentFilename := fmt.Sprintf("_index%s.md", fileLangCodeID)
|
indexContentFilename := fmt.Sprintf("_index%s.md", fileLangCodeID)
|
||||||
writeSource(b, fs, filepath.Join("content", fmt.Sprintf("sect%d", i), indexContentFilename), content)
|
writeSource(b, fs, filepath.Join("content", fmt.Sprintf("sect%d", i), indexContentFilename), content)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue