diff --git a/handler/article.go b/handler/article.go index af0f465..70cd250 100644 --- a/handler/article.go +++ b/handler/article.go @@ -30,7 +30,7 @@ type Article struct { } func (a *Article) GetArticleById(id string) (*Article, error) { - path := os.Getenv("ARTICLE_PATH") + strings.Replace(id, "-", "/", -1) + ".md" + path := os.Getenv("ARTICLE_PATH") + strings.Replace(id, "<-", "/", -1) + ".md" return a.GetArticleByPath(path) } @@ -41,7 +41,7 @@ func (a *Article) GetArticleByPath(path string) (*Article, error) { a.Id = a.Uri[:len(a.Uri)-len(filepath.Ext(a.Uri))] a.Id = strings.Replace(a.Id, "\\", "/", -1) - a.Id = strings.Replace(a.Id, "/", "-", -1) + a.Id = strings.Replace(a.Id, "/", "<-", -1) // 读取文件内容 fileByte, err := ioutil.ReadFile(a.Path)