From 4a0b59c45b1445f35d73d4a8c556bdaafc1ce037 Mon Sep 17 00:00:00 2001 From: atridadl Date: Thu, 8 Feb 2024 19:37:52 -0700 Subject: [PATCH] Fix --- pages/post.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pages/post.go b/pages/post.go index 5d24630..fa7fe54 100644 --- a/pages/post.go +++ b/pages/post.go @@ -3,14 +3,15 @@ package pages import ( "bytes" "html/template" + "io/fs" "net/http" - "os" chromahtml "github.com/alecthomas/chroma/v2/formatters/html" "github.com/labstack/echo/v4" "github.com/yuin/goldmark" highlighting "github.com/yuin/goldmark-highlighting/v2" "gopkg.in/yaml.v2" + contentfs "goth.stack/content" "goth.stack/lib" ) @@ -24,10 +25,11 @@ type PostProps struct { func Post(c echo.Context) error { postName := c.Param("post") - filePath := "content/" + postName + ".md" + filePath := postName + ".md" - md, err := os.ReadFile(filePath) + md, err := fs.ReadFile(contentfs.FS, filePath) if err != nil { + println(err.Error()) http.Error(c.Response().Writer, "This post does not exist!", http.StatusNotFound) return nil }