genblog: add some comments
crispy-caesus crispy@crispy-caesus.eu
Sun, 22 Mar 2026 11:46:25 +0100
1 files changed,
5 insertions(+),
0 deletions(-)
jump to
M
cmd/server/genblog.go
→
cmd/server/genblog.go
@@ -138,18 +138,23 @@ return blogDataSlice
} func generateBlogPosts(blogDataSlice []blogData) { + // for each blog for _, post := range blogDataSlice { + // read file content, err := os.ReadFile( "blog/" + post.Date + " " + post.Title + "/post.txt") if err != nil { fmt.Printf("ERROR reading post file: %s\n", err) } + // replace my link format with html style post.Text = fillLinks(content, post) if post.Text == "" { fmt.Printf("ERROR converting links\n") } + // convert newlines post.Text = strings.ReplaceAll(post.Text, "\n", "<br>") + // throw content into template tpl, err := template.ParseFiles("templates/blogpost.gotmpl") if err != nil { fmt.Printf("ERROR creating template: %s\n", err)