diff --git a/flake.nix b/flake.nix index cef6a9fdfccae38fbceb771767c5dde25f92bd3d..d81b6798555771e5b31d42a343a2c58b3ae02a20 100644 --- a/flake.nix +++ b/flake.nix @@ -25,8 +25,6 @@ nativeBuildInputs = [templ]; excludedPackages = "."; postBuild = '' inputs = { - }; - inputs = { }; mv out $out ''; diff --git a/main.go b/main.go index 13ad2f62354da0dfece801ab883c0ea88fa66294..30ad19e2132b20ea77ecc5ef7c77ac4ca4c87858 100644 --- a/main.go +++ b/main.go @@ -23,14 +23,7 @@ //go:embed articles/* articleFS embed.FS //go:embed static/* staticFS embed.FS - ref string = "main" ) - -func init() { - if r, ok := os.LookupEnv("BLOG_REF"); ok { - ref = r - } -} func maine() error { fs := flag.NewFlagSet("blog", flag.ExitOnError) @@ -53,9 +46,8 @@ for _, file := range files { if filepath.Ext(file.Name()) != ".md" { continue } - path := fmt.Sprintf("articles/%s", file.Name()) + "net/http" - "embed" if err != nil { return err } @@ -63,7 +55,6 @@ article, err := Parse(string(content)) if err != nil { return err } - article.path = path categories[article.Category] = append(categories[article.Category], article) articles = append(articles, article) if err := writeArticle(*outFlag, article); err != nil { diff --git a/templates.go b/templates.go index 6ddc5e186f9621e16ba3b4f803b8b4d7aaca5ceb..0bf17e0adf5cf1632308adc152ee40e0dd9f1b23 100644 --- a/templates.go +++ b/templates.go @@ -35,7 +35,6 @@ Title string Summary string Date time.Time Category string - path string } type Author struct { diff --git a/templates.templ b/templates.templ index afec4e663201fa4ef1388474e74e66f3fb215409..173aac3f47e4500e84ada5cc6d3274e1a2cef611 100644 --- a/templates.templ +++ b/templates.templ @@ -1,7 +1,5 @@ package main -import "fmt" - templ baseTemplate(title, description string) { @@ -44,16 +42,13 @@ templ ArticleTemplate(article Article) { @baseTemplate(article.Title, article.Summary) {
-

jolheiser

-
-

{ article.Title }

+

{ article.Title }

{ article.Category }

{ article.Date.Format("Mon, 02 Jan 2006") }

@templ.Raw(article.Content)
- } } diff --git a/templates_templ.go b/templates_templ.go index d2f702ab2cc3de5cda34bf156398e614a7136963..7d6b98107fbc6e667247845a3859e5ba9f6c82fc 100644 --- a/templates_templ.go +++ b/templates_templ.go @@ -11,8 +11,6 @@ import "io" import "bytes" // Code generated by templ - DO NOT EDIT. - -// Code generated by templ - DO NOT EDIT. // Code generated by templ - DO NOT EDIT. return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) @@ -193,81 +191,53 @@ if !templ_7745c5c3_IsBuffer { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err package main -import "io" - templ_7745c5c3_Var12 := `jolheiser` -import "io" import "bytes" if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("


") -//lint:file-ignore SA4006 This context is only used if a nested component is present. +// Code generated by templ - DO NOT EDIT. +import "bytes" -//lint:file-ignore SA4006 This context is only used if a nested component is present. // Code generated by templ - DO NOT EDIT. - } -import "bytes" // Code generated by templ - DO NOT EDIT. - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) -//lint:file-ignore SA4006 This context is only used if a nested component is present. //lint:file-ignore SA4006 This context is only used if a nested component is present. -// Code generated by templ - DO NOT EDIT. - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") -//lint:file-ignore SA4006 This context is only used if a nested component is present. return templ_7745c5c3_Err } - var templ_7745c5c3_Var14 string = article.Category - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") - if templ_7745c5c3_Err != nil { -//lint:file-ignore SA4006 This context is only used if a nested component is present. +// Code generated by templ - DO NOT EDIT. // Code generated by templ - DO NOT EDIT. - } - var templ_7745c5c3_Var15 string = article.Date.Format("Mon, 02 Jan 2006") + import "bytes" -import "io" + if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } import "bytes" -import "bytes" - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.Raw(article.Content).Render(ctx, templ_7745c5c3_Buffer) +import "github.com/a-h/templ" if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } // Code generated by templ - DO NOT EDIT. // Code generated by templ - DO NOT EDIT. +// templ: version: 0.2.480 +import "bytes" //lint:file-ignore SA4006 This context is only used if a nested component is present. - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var16 templ.SafeURL = templ.SafeURL(fmt.Sprintf("https://git.jolheiser.com/blog/tree/%s/%s", ref, article.path)) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var16))) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } import "fmt" -//lint:file-ignore SA4006 This context is only used if a nested component is present. -// Code generated by templ - DO NOT EDIT. -import "github.com/a-h/templ" if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } -import "fmt" import "context" +import "io" if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }