Make section lower case

kcoram/uplift
Jan-Lukas Else 2019-12-03 17:46:16 +01:00
parent 20bace6e9a
commit fa3bf31ea5
1 changed files with 5 additions and 3 deletions

View File

@ -103,8 +103,6 @@ func createEntryFromValueMap(values map[string][]string) (*Entry, error) {
}
func computeExtraSettings(entry *Entry) error {
now := time.Now()
entry.section = "micro"
// Find settings hidden in content
var filteredContent bytes.Buffer
contentScanner := bufio.NewScanner(strings.NewReader(entry.content))
@ -142,7 +140,7 @@ func computeExtraSettings(entry *Entry) error {
}
}
entry.content = filteredContent.String()
now := time.Now()
// Compute slug if empty
if len(entry.slug) == 0 || entry.slug == "" {
random := generateRandomString(now, 5)
@ -153,6 +151,10 @@ func computeExtraSettings(entry *Entry) error {
if err != nil {
return err
}
if len(entry.section) < 1 {
entry.section = "micro"
}
entry.section = strings.ToLower(entry.section)
if entry.section == "posts" {
entry.filename = "content/" + entry.section + "/" + entry.slug + ".md"
entry.location = blogURL + entry.section + "/" + entry.slug