diff --git a/genblog.go b/genblog.go index c68b3cb..27b0b88 100644 --- a/genblog.go +++ b/genblog.go @@ -2,6 +2,7 @@ package main import ( "bytes" + _ "embed" "encoding/json" "fmt" "os" @@ -9,10 +10,11 @@ import ( "text/template" ) -//const statsPath = "/home/vilmibm/bin/townstats" - const statsPath = "/town/bin/stats" +//go:embed blog.tmpl.html +var blogTmpl string + type newsEntry struct { Title string `json:"title"` // Title of entry Pubdate string `json:"pubdate"` // Human readable date @@ -29,63 +31,19 @@ func _main() error { return err } - hypertextDocument := getHeader() - - for _, entry := range data.News { - entryHTML, err := renderEntry(entry) - if err != nil { - return err - } - - hypertextDocument += entryHTML - } - - hypertextDocument += getFooter() - - fmt.Println(hypertextDocument) - - return nil -} - -func renderEntry(entry newsEntry) (string, error) { - t, err := template.New("news").Parse(` -
ssh join@tilde.town
it can take up to 30 days to be approved and not all applications are approved.
@@ -111,7 +111,7 @@
- the town is a non-commercial thing. donations are appreciated
+ the town is a non-commercial thing. donations are appreciated