From 7cfdc43226930b21bae2e02581672a338a9c0789 Mon Sep 17 00:00:00 2001 From: Himanshu Sardana Date: Wed, 25 Mar 2026 00:42:18 +0000 Subject: feat: better gruvbox theme --- main.go | 10 +- themes/gruvbox/home.html | 678 +++++++++++++++++++++++++++++-------- themes/gruvbox/layout.html | 808 ++++++++++++++++++++++++++++++++++++--------- 3 files changed, 1194 insertions(+), 302 deletions(-) diff --git a/main.go b/main.go index a9404f9..70962cc 100644 --- a/main.go +++ b/main.go @@ -44,19 +44,19 @@ type Frontmatter struct { Tags []string `yaml:"tags"` } +var themeName = "gruvbox" + func main() { contentDir := "./content" outputDir := "./output" posts := make([]Post, 0) - themeName := "modern-light" - args := os.Args if len(args) > 1 { switch args[1] { case "serve": - copyFile("./themes/"+themeName+".css", "./output/style.css") + copyFile("./themes/"+themeName+"/style.css", "./output/style.css") fs := http.FileServer(http.Dir("./output/")) http.Handle("/", fs) @@ -101,7 +101,7 @@ func main() { TOC: toc, } - tmpl, err := template.ParseFiles("./layout.html") + tmpl, err := template.ParseFiles("./themes/" + themeName + "/layout.html") if err != nil { log.Fatalf("Error parsing template: %s", err) } @@ -258,7 +258,7 @@ func renderHomePage(summaries []PostSummary, outputDir string) { panic(err) } - tmpl, err := template.ParseFiles("./home.html") + tmpl, err := template.ParseFiles("./themes/" + themeName + "/home.html") if err != nil { log.Fatalf("Error parsing home template: %s", err) } diff --git a/themes/gruvbox/home.html b/themes/gruvbox/home.html index e002da3..c84214d 100644 --- a/themes/gruvbox/home.html +++ b/themes/gruvbox/home.html @@ -7,275 +7,661 @@ -
- + +
+
- {{ .AuthorRole }} +
+ visitor + @ + {{ .SiteTitle }} + : + ~ + $ + +

{{ .AuthorName }}

+
+ {{ .AuthorRole }} +

{{ .AuthorBio }}

-
-

Writing

+ +
+
+ writing + + ~/posts/ + {{ if .Posts }}{{ len .Posts }} files{{ else }}empty{{ end + }} + +
+ {{ if .Posts }} -
- {{ range .Posts }} - - - {{ .Title }} - - +
+ {{ else }} -

- $ No entries found. -

+
-- no posts yet --
{{ end }} -
+ diff --git a/themes/gruvbox/layout.html b/themes/gruvbox/layout.html index 005a9f6..60474fd 100644 --- a/themes/gruvbox/layout.html +++ b/themes/gruvbox/layout.html @@ -3,244 +3,750 @@ + {{ .Title }} + + + -
- - - {{ if .TOC }} - -
-

{{ .Title }}

-
{{ .Content }}
-
-
+
+ +
+ home + {{ .Title }} +
+ + +
+
post
+

{{ .Title }}

+
+ + +
+ +
+ + +
{{ .Content }}
+
- -- cgit v1.3.1