remove unnecessary subfolders from blogging

This commit is contained in:
gutmet 2020-12-24 09:41:16 +01:00
parent d50d922c8d
commit 9f3a2f2212

View File

@ -27,16 +27,7 @@ var categories map[string][]Post
func linkToPost(filename string) string { func linkToPost(filename string) string {
filename = filepath.Base(filename) filename = filepath.Base(filename)
split := strings.Split(filename, "-") return fmt.Sprintf("/%s/%s", folder, ConvASCII(filename))
if len(split) < 4 {
return ""
} else {
year := split[0]
month := split[1]
day := split[2]
name := ConvASCII(strings.Join(split[3:], "-"))
return fmt.Sprintf("/%s/%s/%s/%s/%s", folder, year, month, day, name)
}
} }
func linkToCategory(name string) string { func linkToCategory(name string) string {