structure: add language identifier for blog (also some other cleanup)
crispy-caesus crispy@crispy-caesus.eu
Thu, 02 Apr 2026 21:55:00 +0200
6 files changed,
25 insertions(+),
29 deletions(-)
M
cmd/server/genblog.go
→
cmd/server/genblog.go
@@ -28,8 +28,8 @@ generateBlogPosts(blogDataSlice)
} func genBlogDir() { - os.RemoveAll("html/blog") - err := os.Mkdir("html/blog", 0o755) + os.RemoveAll("html/en/blog") + err := os.Mkdir("html/en/blog", 0o755) check(err) }@@ -112,24 +112,24 @@ fmt.Println(post)
blogDataSlice = append(blogDataSlice, blogData{ Date: post[:10], Title: post[11:], - URL: "blog/" + + URL: "/en/blog/" + strings.ToLower(strings.ReplaceAll(post, " ", "-")), }) } // template - tpl, err := template.ParseFiles("templates/blogposts.gotmpl") + tpl, err := template.ParseFiles("templates/blogindex.html.gotmpl") if err != nil { fmt.Printf("ERROR creating template: %s\n", err) } - f, err := os.Create("html/blog.html") + f, err := os.Create("html/en/blog.html") if err != nil { fmt.Printf("ERROR creating html: %s\n", err) panic(1) } - err = tpl.ExecuteTemplate(f, "blogposts.gotmpl", blogDataSlice) + err = tpl.ExecuteTemplate(f, "blogindex.html.gotmpl", blogDataSlice) if err != nil { fmt.Printf("ERROR executing template: %s\n", err) }@@ -155,7 +155,7 @@ // convert newlines
post.Text = strings.ReplaceAll(post.Text, "\n", "<br>") // throw content into template - tpl, err := template.ParseFiles("templates/blogpost.gotmpl") + tpl, err := template.ParseFiles("templates/blogpost.html.gotmpl") if err != nil { fmt.Printf("ERROR creating template: %s\n", err) }@@ -166,7 +166,7 @@ fmt.Printf("ERROR creating html: %s\n", err)
panic(1) } - err = tpl.ExecuteTemplate(f, "blogpost.gotmpl", post) + err = tpl.ExecuteTemplate(f, "blogpost.html.gotmpl", post) if err != nil { fmt.Printf("ERROR executing template: %s\n", err) }
M
cmd/server/gensite.go
→
cmd/server/gensite.go
@@ -23,4 +23,6 @@ func genSiteDirs() {
os.RemoveAll("html") err := os.Mkdir("html", 0o755) check(err) + err = os.Mkdir("html/en", 0o755) + check(err) }
M
cmd/server/main.go
→
cmd/server/main.go
@@ -30,7 +30,7 @@ }
} fs := http.FileServer(http.Dir("static")) - blogfs := http.FileServer(http.Dir("blog")) + blogfs := http.FileServer(http.Dir("en/blog")) http.Handle("/static/", http.StripPrefix("/static/", fs)) http.Handle("/attachments/", http.StripPrefix("/attachments/", blogfs))
M
templates/blogpost.gotmpl
→
templates/blogpost.html.gotmpl
@@ -3,8 +3,8 @@ <html lang="en">
<head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>{{.Title}}</title> - <link rel="stylesheet" href="../static/global.css" /> - <link rel="stylesheet" href="../static/center.css" /> + <link rel="stylesheet" href="/static/global.css" /> + <link rel="stylesheet" href="/static/center.css" /> <link rel="icon" type="image/png" href="../static/banan_icon.png" /> </head> <body>
M
templates/blogposts.gotmpl
→
templates/blogindex.html.gotmpl
@@ -9,9 +9,12 @@ <link rel="icon" type="image/png" href="../static/banan_icon.png" />
</head> <body> <div> - <h1>Crispy Blog</h1> + <h1>crispy blog</h1> {{range .}} <p>{{.Date}} <a href="{{.URL}}">{{.Title}}</a></p> {{end}} + </div> + <div> + <a href="/en/blog/rss.xml">RSS</a> </div> </body>
M
templates/index.html
→
templates/index.html
@@ -22,14 +22,14 @@ class="banana-img non-pixelated"
/> <p> I'm a 19-year-old university student from Germany, aspiring to - become a system engineer/administrator. I like tinkering around with my - Linux systems and write a little program here and there. + become a system engineer/administrator. I like tinkering around + with my Linux systems and write a little program here and there. </p> <p> Currently I am doing my bachelor's in a Duale Hochschule. In my free time (and potentially <i>sometimes</i> during lectures) I - work on my homelab and regret all the other projects I started - and am lagging behind in. + work on my homelab and regret all the other projects I started and + am lagging behind in. </p> </article> <div class="small-box container cool-people">@@ -82,7 +82,7 @@ <div class="box links">
<h2>some links</h2> <ul> <li> - <a title="Blog" href="/blog">Blog</a> + <a title="Blog" href="/en/blog">Blog</a> <p> My little blog, where I'll post cool things I found, thoughts I have and show some stuff I'm doing@@ -173,21 +173,12 @@
<footer> <div class="credits box"> <p> - <a - title="Licenses" - href="licenses" - >Licenses</a - > - | - <a - title="Privacy Policy" - href="privacy" - >Privacy</a - > + <a title="Licenses" href="licenses">Licenses</a> + | + <a title="Privacy Policy" href="privacy">Privacy</a> </p> </div> </footer> - </div> </body> </html>