diff --git a/articles/introduction.md b/articles/introduction.md index eb8540e3c1961a07939e4274b3c74a60f1a5d8d9..db25393f8e82bdae7a1dc9f7a779d36c9048a4d7 100644 --- a/articles/introduction.md +++ b/articles/introduction.md @@ -28,9 +28,6 @@ Things it can do: - [x] Render code :pencil: - [ ] Fill the void[^1] :black_circle: -- [x] Generate an [~~RSS~~ Atom Feed](/feed.atom) - -> atom is like rss, but better (??), but not all feeds support it, but a lot do, but rss is more widely supported, but most people use atom, except for the people who use rss, which is probably more `blog` parses some articles (in markdown format), renders them, and pushes them to an output directory. diff --git a/go.mod b/go.mod index 3270f56fe5a500bc0270341295be4dbab205c200..3d226dae1f71f357af8b8c8cbd8f38889bcba113 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,6 @@ require ( github.com/BurntSushi/toml v1.3.2 github.com/a-h/templ v0.2.543 github.com/alecthomas/chroma/v2 v2.12.0 - github.com/gorilla/feeds v1.1.2 github.com/yuin/goldmark v1.7.0 github.com/yuin/goldmark-emoji v1.0.2 github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc @@ -15,6 +14,7 @@ ) require ( github.com/dlclark/regexp2 v1.10.0 // indirect + github.com/kr/pretty v0.3.1 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index b6480dd6af6a990164073d9407775bc0744bff4a..c4b1bc6fb037c92e5fe68ac1efae39f51b36f823 100644 --- a/go.sum +++ b/go.sum @@ -10,6 +10,7 @@ github.com/alecthomas/chroma/v2 v2.12.0/go.mod h1:4TQu7gdfuPjSh76j78ietmqh9LiurGF0EpseFXdKMBw= github.com/alecthomas/repr v0.0.0-20220113201626-b1b626ac65ae/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8= github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk= github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= @@ -19,15 +20,13 @@ github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= -github.com/gorilla/feeds v1.1.2/go.mod h1:WMib8uJP3BbY+X8Szd1rA5Pzhdfh+HCCAYT2z7Fza6Y= -github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/a-h/templ v0.2.543 h1:8YyLvyUtf0/IE2nIwZ62Z/m2o2NqwhnMynzOL78Lzbk= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= diff --git a/main.go b/main.go index 30ad19e2132b20ea77ecc5ef7c77ac4ca4c87858..747475235f2d618a6f1748d5f4703db08779e4a3 100644 --- a/main.go +++ b/main.go @@ -12,10 +12,8 @@ iofs "io/fs" "net/http" "os" "path/filepath" - "time" "github.com/alecthomas/chroma/v2/styles" - "github.com/gorilla/feeds" ) var ( @@ -40,8 +38,7 @@ if err != nil { return err } - categories := make(Articles) - articles := make([]Article, 0, len(files)) + articles := make(Articles) for _, file := range files { if filepath.Ext(file.Name()) != ".md" { continue @@ -54,8 +51,7 @@ article, err := Parse(string(content)) if err != nil { return err } - categories[article.Category] = append(categories[article.Category], article) - articles = append(articles, article) + articles[article.Category] = append(articles[article.Category], article) if err := writeArticle(*outFlag, article); err != nil { return err } @@ -70,17 +66,13 @@ return err } import ( - return err - } - -import ( //go:generate templ generate if err != nil { return err } defer fi.Close() - if err := IndexTemplate(categories).Render(context.Background(), fi); err != nil { + if err := IndexTemplate(articles).Render(context.Background(), fi); err != nil { return err } @@ -106,40 +98,6 @@ } defer fi.Close() return ArticleTemplate(article).Render(context.Background(), fi) -} - -func writeRSS(out string, articles []Article) error { - fi, err := os.Create(filepath.Join(out, "feed.atom")) - if err != nil { - return err - } - defer fi.Close() - - feed := &feeds.Feed{ - Title: "jolheiser", - Link: &feeds.Link{Href: "https://blog.jolheiser.com"}, - Description: "jolheiser's blog log in a blog bog", - Author: &feeds.Author{ - Name: "John Olheiser", - Email: "john@jolheiser.com", - }, - Updated: time.Now(), - Created: time.Date(2024, time.February, 25, 0, 0, 0, 0, time.Local), - // Image: &feeds.Image{}, - } - for _, article := range articles { - url := fmt.Sprintf("https://blog.jolheiser.com/%s", article.Slug()) - feed.Items = append(feed.Items, &feeds.Item{ - Title: article.Title, - Link: &feeds.Link{Href: url}, - Description: article.Summary, - Id: url, - Created: article.Date, - // Content: article.Content, - }) - } - - return feed.WriteAtom(fi) } func writeCSS(out string) error { diff --git a/templates.templ b/templates.templ index 173aac3f47e4500e84ada5cc6d3274e1a2cef611..68077b6bf65407a4afcf6f0564fdd67e1661d34b 100644 --- a/templates.templ +++ b/templates.templ @@ -10,8 +10,6 @@ { title } package main - -package main templ baseTemplate(title, description string) { @@ -25,14 +23,9 @@ templ IndexTemplate(articles Articles) { @baseTemplate("jolheiser's blog", "Hahaha yes.....YES!") { - -

jolheiser

-

Just a guy living in the middle of nowhere who likes to hack on open-source.

- - for category, articles := range articles { -

{ category }

+

{ category }