use path for file names
This commit is contained in:
parent
0bb5a51059
commit
b5fbc42521
16
main.go
16
main.go
@ -7,6 +7,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
@ -265,9 +266,10 @@ func main() {
|
|||||||
posts := Posts{}
|
posts := Posts{}
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
fn := file.Name()
|
fn := file.Name()
|
||||||
srcFile := src + "/" + fn
|
srcFile := path.Join(src, fn)
|
||||||
dstFile := dst + "/" + md2html(fn)
|
dstFile := path.Join(dst, "/posts/", md2html(fn))
|
||||||
post, err := renderPost(srcFile, fn)
|
post, err := renderPost(srcFile, path.Join("/posts/", fn))
|
||||||
|
fmt.Println("-----")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -283,8 +285,8 @@ func main() {
|
|||||||
|
|
||||||
sort.Sort(posts)
|
sort.Sort(posts)
|
||||||
|
|
||||||
renderTemplate(dst+"/index.html", "index.html", posts)
|
renderTemplate(path.Join(dst, "/index.html"), "index.html", posts)
|
||||||
renderTemplate(dst+"/about.html", "about.html", posts[0].Author)
|
renderTemplate(path.Join(dst, "/about.html"), "about.html", posts[0].Author)
|
||||||
renderTemplate(dst+"/contact.html", "contact.html", posts[0].Author)
|
renderTemplate(path.Join(dst, "/contact.html"), "contact.html", posts[0].Author)
|
||||||
renderTemplate(dst+"/archive.html", "archive.html", posts[5:])
|
renderTemplate(path.Join(dst, "/archive.html"), "archive.html", posts[5:])
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user