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