commit d36a853f9447e40211436ec0b01b6ded3f40dd97 Author: kisukalat Date: Sat Aug 30 17:15:58 2025 +0300 initial commit diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..566a33a --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module kisukalat.xyz + +go 1.24.6 diff --git a/main.go b/main.go new file mode 100644 index 0000000..23e31b2 --- /dev/null +++ b/main.go @@ -0,0 +1,48 @@ +package main + +import ( + "html/template" + "log" + "net/http" + "strings" + "path/filepath" + "os" +) + +func pageHandler(w http.ResponseWriter, r *http.Request) { + path := strings.Trim(r.URL.Path, "/") + if path == "" { + path = "home" + } + + exePath, err := os.Executable() + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + exeDir := filepath.Dir(exePath) + templateDir := filepath.Join(exeDir, "templates") + + tmpl, err := template.ParseFiles( + filepath.Join(templateDir, "layout.html"), + filepath.Join(templateDir, "header.html"), + filepath.Join(templateDir, "footer.html"), + filepath.Join(templateDir, path+".html"), + ) + if err != nil { + http.NotFound(w, r) + return + } + + err = tmpl.ExecuteTemplate(w, "layout", nil) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + } +} + +func main() { + http.HandleFunc("/", pageHandler) + + log.Println("Server running at http://localhost:14888") + log.Fatal(http.ListenAndServe(":14888", nil)) +} diff --git a/static/style.css b/static/style.css new file mode 100644 index 0000000..bbd62ad --- /dev/null +++ b/static/style.css @@ -0,0 +1,109 @@ +html { + background: #5E0084; + padding-bottom: 400px; +} +body { + max-width: 750px; + margin-left: auto; + margin-right: auto; + margin-top: 30px; + background: #002F5E; + color: #eee; + border-style: solid; + border-width: 5px; + border-color: #123; + } + + +main { + padding: 1em ; +} + +h1,h2,h3,h4 { + text-align: center; + } +h1 { + font-size: 48px; + text-shadow: 3px 0 black, 3px 3px black, 0 3px black; + color: blue; + } + +.links { + display: list-item; + list-style: none; + text-align: center; + font-size: 48pt; + margin: 0; + display: block; + padding: 0; +} + +img .links { + height: 64px; + width: 64px; +} +h2 { + color: #00bbdd ; +} + +h3 { + color: #00aabb ; +} + +a { color: lightblue; } + +.image { + margin: auto; +} + +.qr { max-width: 150px ; padding: 10px } + +p img, li img, h1 img, h2 img, h3 img, h4 img { + max-height: 1em; + max-width: 1em; +} + +pre { + border: 1px solid lime ; + border-radius: 20px ; + padding: 1em ; + margin: 1em ; + white-space: pre-wrap; +} + +code { + border-radius: 5px ; + overflow-wrap: break-word ; + font-size: x-small; +} + +code:not(pre code) { + color: lime; +} + +aside { + color: gray ; + font-style: italic ; + font-size: small ; +} + +footer { + text-align: center ; +} + +header { + padding-left: 1rem; +} + +.normal { + align: center ; +} + +.normal img { + margin: auto ; + max-width: 90% ; + max-height: 400px ; + display: block ; +} + +} diff --git a/templates/about.html b/templates/about.html new file mode 100644 index 0000000..610c8bf --- /dev/null +++ b/templates/about.html @@ -0,0 +1,4 @@ +{{define "content"}} +

abouaboutt

+

im supoer cool

+{{end}} diff --git a/templates/footer.html b/templates/footer.html new file mode 100644 index 0000000..a843e6a --- /dev/null +++ b/templates/footer.html @@ -0,0 +1,7 @@ + diff --git a/templates/header.html b/templates/header.html new file mode 100644 index 0000000..e210984 --- /dev/null +++ b/templates/header.html @@ -0,0 +1,6 @@ +
+

+ Home | + About +

+
diff --git a/templates/home.html b/templates/home.html new file mode 100644 index 0000000..8a1d15d --- /dev/null +++ b/templates/home.html @@ -0,0 +1,5 @@ +{{define "content"}} +

Kisu's homepage

+

Resist Resist Resist

+ +{{end}} diff --git a/templates/layout.html b/templates/layout.html new file mode 100644 index 0000000..b02de7d --- /dev/null +++ b/templates/layout.html @@ -0,0 +1,19 @@ +{{define "layout"}} + + + + + + + + + {{template "header.html" .}} + +
+ {{block "content" .}} {{end}} + {{template "footer.html" .}} +
+ + + +{{end}}