all repos — searchix @ 5127a98c591d206c0791b3049e8ae30b87ddf2dd

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat: add flag to generate error page for web server

Alan Pearce
commit

5127a98c591d206c0791b3049e8ae30b87ddf2dd

parent

44094c54e3ab6217c83b5dfc9739b25cadd323a1

1 file changed, 18 insertions(+), 14 deletions(-)

changed files
M internal/components/page.gointernal/components/page.go
@@ -21,11 +21,13 @@ Meta(Name("viewport"), Content("width=device-width, initial-scale=1")),
TitleEl(g.Text("Searchix"), g.If(config.DevMode, g.Text(" (Dev)"))), g.Map(tdata.Assets.Stylesheets, css), g.Raw(tdata.ExtraHeadHTML), - Link( - Rel("search"), - Type("application/opensearchdescription+xml"), - TitleAttr("Searchix "+sourceNameAndType(nil)), - Href(joinPath("opensearch.xml")), + g.If(len(tdata.Sources) > 0, + Link( + Rel("search"), + Type("application/opensearchdescription+xml"), + TitleAttr("Searchix "+sourceNameAndType(nil)), + Href(joinPath("opensearch.xml")), + ), ), g.Map(tdata.Sources, func(source *config.Source) g.Node { return Link(
@@ -40,16 +42,18 @@ Body(
Header( Nav( H1(A(Href("/"), g.Text("Searchix"))), - A( - c.Classes{ - "current": tdata.Source == nil, - }, - g.If( - tdata.Source == nil, - Href("/"), - Href(joinPathQuery("/", tdata.Query)), + g.If(len(tdata.Sources) > 0, + A( + c.Classes{ + "current": tdata.Source == nil, + }, + g.If( + tdata.Source == nil, + Href("/"), + Href(joinPathQuery("/", tdata.Query)), + ), + g.Text("All"), ), - g.Text("All"), ), g.Map(tdata.Sources, func(source *config.Source) g.Node { if tdata.Source != nil && tdata.Source.Name == source.Name {