remove unnecessary subfolders from blogging
This commit is contained in:
parent
d50d922c8d
commit
9f3a2f2212
11
blog/blog.go
11
blog/blog.go
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user